Debian Codegraph @

src/cups/backend_hiti.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*
2 * HiTi Photo Printer CUPS backend
3 *
4 * (c) 2019-2026 Solomon Peachy <[email protected]>
5 *
6 * The latest version of this program can be found at:
7 *
8 * https://git.shaftnet.org/gitea/slp/selphy_print.git
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <https://www.gnu.org/licenses/>.
22 *
23 * SPDX-License-Identifier: GPL-2.0+
24 *
25 */
26
27 #define BACKENDcxx . . $ `src/cups/backend_hiti.c:27:9`! hiti_backend
28
29 #include "backend_common.h"cxx . . $ `<file>/src/cups/backend_common.h`/
30
31 /* For Integration into gutenprint */
32 #if defined(HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!)
33 #include <config.h>cxx . . $ `<file>/config.h`/
34 #endif
35
36 // We should use nanosleep everywhere properly.
37 #define __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(__x) { struct timespec t = { 0, (__x) * 1000 } ; nanosleep (&t, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); }
38
39 /* Private structures */
40 struct hiti_cmdcxx . . $ hiti_cmd# {
41 uint8_tcxx . . $ uint8_t# hdrcxx . . $ hiti_cmd#hdr.; /* 0xa5 */
42 uint16_tcxx . . $ uint16_t# lencxx . . $ hiti_cmd#len.; /* (BE) everything after this field, minimum 3, max 64 */
43 uint8_tcxx . . $ uint8_t# flagcxx . . $ hiti_cmd#flag.; /* see CMD_FLAG_* -- MUST include CMD_FLAG_DEST */
44 uint16_tcxx . . $ uint16_t# cmdcxx . . $ hiti_cmd#cmd.; /* CMD_* (BE) */
45 uint8_tcxx . . $ uint8_t# payloadcxx . . $ hiti_cmd#payload.[]; /* 0-61 items */
46 } __attribute__((packed));
47
48 struct hiti_cmd_luncxx . . $ hiti_cmd_lun# {
49 uint8_tcxx . . $ uint8_t# hdrcxx . . $ hiti_cmd_lun#hdr.; /* 0xa5 */
50 uint16_tcxx . . $ uint16_t# lencxx . . $ hiti_cmd_lun#len.; /* (BE) everything after this field, minimum 4, max 64 */
51 uint8_tcxx . . $ uint8_t# flagcxx . . $ hiti_cmd_lun#flag.; /* see CMD_FLAG_* -- MUST NOT include CMD_FLAG_DEST */
52 uint8_tcxx . . $ uint8_t# luncxx . . $ hiti_cmd_lun#lun.;
53 uint16_tcxx . . $ uint16_t# cmdcxx . . $ hiti_cmd_lun#cmd.; /* CMD_* (BE) */
54 uint8_tcxx . . $ uint8_t# payloadcxx . . $ hiti_cmd_lun#payload.[]; /* 0-60 items */
55 } __attribute__((packed));
56
57 #define CMD_FLAG_NOP_ERRcxx . . $ `src/cups/backend_hiti.c:57:9`! 0x80
58 #define CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! 0x40
59 #define CMD_FLAG_CONTINUEcxx . . $ `src/cups/backend_hiti.c:59:9`! 0x20
60 #define CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`! 0x10
61
62 #define CMD_FLAG_CHK_MASKcxx . . $ `src/cups/backend_hiti.c:62:9`! 0x8c
63 #define CMD_FLAG_CHK_OKcxx . . $ `src/cups/backend_hiti.c:63:9`! 0x00
64 #define CMD_FLAG_CHK_REJECTEDcxx . . $ `src/cups/backend_hiti.c:64:9`! 0x80 // no errors, but rejected
65 #define CMD_FLAG_CHK_DATAERRcxx . . $ `src/cups/backend_hiti.c:65:9`! 0x84 // error in data stream
66 #define CMD_FLAG_CHK_CMDERRcxx . . $ `src/cups/backend_hiti.c:66:9`! 0x88 // error in command itself
67
68 #define CMD_FLAG_STS_MASKcxx . . $ `src/cups/backend_hiti.c:68:9`! 0x03
69 #define CMD_FLAG_STS_OKcxx . . $ `src/cups/backend_hiti.c:69:9`! 0x00 // OK
70 #define CMD_FLAG_STS_CONDcxx . . $ `src/cups/backend_hiti.c:70:9`! 0x01 // OK, but alert to a condition
71 #define CMD_FLAG_STS_OPERcxx . . $ `src/cups/backend_hiti.c:71:9`! 0x02 // operator intervention required (eg media)
72 #define CMD_FLAG_STS_ERRcxx . . $ `src/cups/backend_hiti.c:72:9`! 0x03 // fatal, eg memory error
73
74 /* Request Device Characteristics */
75 #define CMD_RDC_RScxx . . $ `src/cups/backend_hiti.c:75:9`! 0x0100 /* Request Summary */
76 #define CMD_RDC_ROCcxx . . $ `src/cups/backend_hiti.c:76:9`! 0x0104 /* Request Option Characteristics (1 resp on p52x, not on p51x, 16 on p461 */
77
78 /* Printer Configuratio Control */
79 #define CMD_PCC_RPcxx . . $ `src/cups/backend_hiti.c:79:9`! 0x0301 /* Reset Printer (1 arg) */
80 #define CMD_RCC_UNKcxx . . $ `src/cups/backend_hiti.c:80:9`! 0x0310 /* XX Unknown */
81 #define CMD_PCC_STPcxx . . $ `src/cups/backend_hiti.c:81:9`! 0x030F /* Set Target Printer (1 arg) XXX -- 00 == master or 01 == slave ? Or maybe it's a bank select for CMD_EFM_RNV? */
82
83 /* Request Device Status */
84 #define CMD_RDS_RSScxx . . $ `src/cups/backend_hiti.c:84:9`! 0x0400 /* Request Status Summary */
85 #define CMD_RDS_RIScxx . . $ `src/cups/backend_hiti.c:85:9`! 0x0401 /* Request Input Status */
86 #define CMD_RDS_RIAcxx . . $ `src/cups/backend_hiti.c:86:9`! 0x0403 /* Request Input Alert */
87 #define CMD_RDS_RJAcxx . . $ `src/cups/backend_hiti.c:87:9`! 0x0405 /* Request Jam Alert */
88 #define CMD_RDS_ROIRAcxx . . $ `src/cups/backend_hiti.c:88:9`! 0x0406 /* Request Operator Intervention Alert */
89 #define CMD_RDS_RWcxx . . $ `src/cups/backend_hiti.c:89:9`! 0x0407 /* Request Warnings */
90 #define CMD_RDS_DSRAcxx . . $ `src/cups/backend_hiti.c:90:9`! 0x0408 /* Request Device Serviced Alerts */
91 #define CMD_RDS_SAcxx . . $ `src/cups/backend_hiti.c:91:9`! 0x040A /* Request Service Alerts */
92 #define CMD_RDS_RPScxx . . $ `src/cups/backend_hiti.c:92:9`! 0x040B /* Request Printer Statistics */
93 #define CMD_RDS_RSUScxx . . $ `src/cups/backend_hiti.c:93:9`! 0x040C /* Request Supplies Status */
94
95 /* Job Control */
96 #define CMD_JC_SJcxx . . $ `src/cups/backend_hiti.c:96:9`! 0x0500 /* Start Job (3 arg) */
97 #define CMD_JC_EJcxx . . $ `src/cups/backend_hiti.c:97:9`! 0x0501 /* End Job (3 arg) */
98 #define CMD_JC_QJCcxx . . $ `src/cups/backend_hiti.c:98:9`! 0x0502 /* Query Job Completed (5 arg) XX 6 byte resp (most), 2 (p461) */
99 #define CMD_JC_QQAcxx . . $ `src/cups/backend_hiti.c:99:9`! 0x0503 /* Query Jobs Queued or Active (3 arg), 1 rsp */
100 #define CMD_JC_RSJcxx . . $ `src/cups/backend_hiti.c:100:9`! 0x0510 /* Resume Suspended Job (3 arg) XX */
101
102 /* Extended Read Device Characteristics */
103 #define CMD_ERDC_RScxx . . $ `src/cups/backend_hiti.c:103:9`! 0x8000 /* Request Summary */
104 #define CMD_ERDC_RCCcxx . . $ `src/cups/backend_hiti.c:104:9`! 0x8001 /* Read Calibration Charcteristics */
105 #define CMD_ERDC_RPCcxx . . $ `src/cups/backend_hiti.c:105:9`! 0x8005 /* Request Print Count (1 arg, 8 (51x) or 4 (52x,7xx) resp) */
106 #define CMD_ERDC_RLCcxx . . $ `src/cups/backend_hiti.c:106:9`! 0x8006 /* Request LED calibration (10 on 52x, 6 on 461 */
107 #define CMD_ERDC_RSNcxx . . $ `src/cups/backend_hiti.c:107:9`! 0x8007 /* Read Serial Number (1 arg) */
108 #define CMD_ERDC_C_RPCScxx . . $ `src/cups/backend_hiti.c:108:9`! 0x8008 /* CS Request Printer Correction Status */
109 #define CMD_ERDC_CTVcxx . . $ `src/cups/backend_hiti.c:109:9`! 0x8008 /* Color Table Version XXX p51x, string (14 byte reply?), error on p461 */
110 #define CMD_ERDC_RPIDMcxx . . $ `src/cups/backend_hiti.c:110:9`! 0x8009 /* Request PID and Model Code */
111 #define CMD_ERDC_UNKAcxx . . $ `src/cups/backend_hiti.c:111:9`! 0x800A /* XX Unknown */
112 #define CMD_ERDC_UNKCcxx . . $ `src/cups/backend_hiti.c:112:9`! 0x800C /* XX p51x Unknown, 4 byte resp (00 87 00 02) */
113 #define CMD_ERDC_UNKDcxx . . $ `src/cups/backend_hiti.c:113:9`! 0x800D /* XX Unknown (1 arg) */
114 #define CMD_ERDC_RTLVcxx . . $ `src/cups/backend_hiti.c:114:9`! 0x800E /* Request T/L Voltage */
115 #define CMD_ERDC_RRVCcxx . . $ `src/cups/backend_hiti.c:115:9`! 0x800F /* Read Ribbon Vendor Code */
116 #define CMD_ERDC_UNK0cxx . . $ `src/cups/backend_hiti.c:116:9`! 0x8010 /* Used when printer doesn't support RRVC? NOT p525/u826 */
117 #define CMD_ERDC_RHTVcxx . . $ `src/cups/backend_hiti.c:117:9`! 0x8011 /* Request Heating Paramaters Table VersionXX p52x Unknown Query */
118 #define CMD_ERDC_RHAcxx . . $ `src/cups/backend_hiti.c:118:9`! 0x801C /* Read Highlight Adjustment (6 resp) RE */
119
120 /* Extended Format Data */
121 #define CMD_EFD_SFcxx . . $ `src/cups/backend_hiti.c:121:9`! 0x8100 /* Sublimation Format */
122 #define CMD_EFD_CHScxx . . $ `src/cups/backend_hiti.c:122:9`! 0x8101 /* Color & Heating Setting (2 arg) -- Not P525/U826/P630 */
123 #define CMD_EFD_C_CHScxx . . $ `src/cups/backend_hiti.c:123:9`! 0x8102 /* CS Color Heating Setting (3 arg) */
124 #define CMD_EFD_C_SIIDcxx . . $ `src/cups/backend_hiti.c:124:9`! 0x8103 /* CS Set Input ID (1 arg) */
125
126 /* Extended Page Control */
127 #define CMD_EPC_SPcxx . . $ `src/cups/backend_hiti.c:127:9`! 0x8200 /* Start Page */
128 #define CMD_EPC_EPcxx . . $ `src/cups/backend_hiti.c:128:9`! 0x8201 /* End Page */
129 #define CMD_EPC_SYPcxx . . $ `src/cups/backend_hiti.c:129:9`! 0x8202 /* Start Yellow Plane */
130 #define CMD_EPC_SMPcxx . . $ `src/cups/backend_hiti.c:130:9`! 0x8204 /* Start Magenta Plane */
131 #define CMD_EPC_SCPcxx . . $ `src/cups/backend_hiti.c:131:9`! 0x8206 /* Start Cyan Plane */
132
133 #define CMD_EPC_C_SYPcxx . . $ `src/cups/backend_hiti.c:133:9`! 0x8202 /* CS Start Yellow Page */
134 #define CMD_EPC_C_SMPcxx . . $ `src/cups/backend_hiti.c:134:9`! 0x8203 /* CS Start Magenta Page */
135 #define CMD_EPC_C_SCPcxx . . $ `src/cups/backend_hiti.c:135:9`! 0x8204 /* CS Start Cyan Page */
136 #define CMD_EPC_C_SBPcxx . . $ `src/cups/backend_hiti.c:136:9`! 0x8205 /* CS Start Black Page */
137 #define CMD_EPC_C_SKPcxx . . $ `src/cups/backend_hiti.c:137:9`! 0x8206 /* CS Start K Resin Page */
138 #define CMD_EPC_C_SLPcxx . . $ `src/cups/backend_hiti.c:138:9`! 0x8207 /* CS Start Lamination Page */
139 #define CMD_EPC_C_SOPcxx . . $ `src/cups/backend_hiti.c:139:9`! 0x8208 /* CS Start Overcoat Page */
140 #define CMD_EPC_C_SY2Pcxx . . $ `src/cups/backend_hiti.c:140:9`! 0x8209 /* CS Start Yellow2 Page */
141 #define CMD_EPC_C_SM2Pcxx . . $ `src/cups/backend_hiti.c:141:9`! 0x820A /* CS Start Magenta2 Page */
142 #define CMD_EPC_C_SC2Pcxx . . $ `src/cups/backend_hiti.c:142:9`! 0x820B /* CS Start Cyan2 Page */
143 #define CMD_EPC_C_SB2Pcxx . . $ `src/cups/backend_hiti.c:143:9`! 0x820C /* CS Start Black2 Page */
144 #define CMD_EPC_C_SK2Pcxx . . $ `src/cups/backend_hiti.c:144:9`! 0x820D /* CS Start K Resin2 Page */
145 #define CMD_EPC_C_SL2Pcxx . . $ `src/cups/backend_hiti.c:145:9`! 0x820E /* CS Start Lamination2 Page */
146 #define CMD_EPC_C_SO2Pcxx . . $ `src/cups/backend_hiti.c:146:9`! 0x820F /* CS Start Overcoat2 Page */
147
148 /* Extended Send Data */
149 #define CMD_ESD_SEHT2cxx . . $ `src/cups/backend_hiti.c:149:9`! 0x8303 /* Send Ext Heating Table (2 arg) */
150 #define CMD_ESD_SEHTcxx . . $ `src/cups/backend_hiti.c:150:9`! 0x8304 /* Send Ext Heating Table XX */
151 #define CMD_ESD_UNK6cxx . . $ `src/cups/backend_hiti.c:151:9`! 0x8306 /* Unknown, seen in FW update (1 byte payload) */
152 #define CMD_ESD_UNK7cxx . . $ `src/cups/backend_hiti.c:152:9`! 0x8307 /* Unknown, seen in FW update (no payload) */
153 #define CMD_ESD_SDcxx . . $ `src/cups/backend_hiti.c:153:9`! 0x8308 /* Send data (256 or 0xfc00 byte payload) */
154 #define CMD_ESD_SEPDcxx . . $ `src/cups/backend_hiti.c:154:9`! 0x8309 /* Send Ext Print Data (2 arg) + struct */
155 #define CMD_ESD_SHCIcxx . . $ `src/cups/backend_hiti.c:155:9`! 0x830A /* Unknown, seen on P51x (4 byte payload) */
156 #define CMD_ESD_SHPTCcxx . . $ `src/cups/backend_hiti.c:156:9`! 0x830B /* Send Heating Parameters & Tone Curve (varying payload) */
157 #define CMD_ESD_SHPTC2cxx . . $ `src/cups/backend_hiti.c:157:9`! 0x830C /* Send Heating Parameters & Tone Curve Extended (when SHPTC is > 64K) */
158
159 /* Extended Flash/NVram */
160 #define CMD_EFM_WCVcxx . . $ `src/cups/backend_hiti.c:160:9`! 0x8403 /* Write Calibration Value (n arg) */
161 #define CMD_EFM_RNVcxx . . $ `src/cups/backend_hiti.c:161:9`! 0x8405 /* Read NVRam (1 arg) -- arg is offset, 1 byte resp of data @ that offset. -- P51x */
162 #define CMD_EFM_UNK6cxx . . $ `src/cups/backend_hiti.c:162:9`! 0x8406 /* Write NVRAM, maybe? */
163 #define CMD_EFM_RDcxx . . $ `src/cups/backend_hiti.c:163:9`! 0x8408 /* Read single location (2 byte offset arg, 1 byte of data @ that offset -- not P51x */
164 #define CMD_EFM_UNKCcxx . . $ `src/cups/backend_hiti.c:164:9`! 0x840C /* Write NVRAM, maybe? */
165 #define CMD_EFM_SHAcxx . . $ `src/cups/backend_hiti.c:165:9`! 0x840E /* Set Highlight Adjustment (5 arg) -- XXX RE */
166
167 #define CMD_ERD_RTCVcxx . . $ `src/cups/backend_hiti.c:167:9`! 0x8702 /* XX No idea what this does */
168
169 /* Extended Security Control */
170 #define CMD_ESC_SPcxx . . $ `src/cups/backend_hiti.c:170:9`! 0x8900 /* Set Password */
171 #define CMD_ESC_SSMcxx . . $ `src/cups/backend_hiti.c:171:9`! 0x8901 /* Set Security Mode */
172
173 /* Extended Debug Mode */
174 #define CMD_EDM_CVDcxx . . $ `src/cups/backend_hiti.c:174:9`! 0xE002 /* Common Voltage Drop Values (n arg) */
175 #define CMD_EDM_CPPcxx . . $ `src/cups/backend_hiti.c:175:9`! 0xE023 /* Clean Paper Path (1 arg) XX */
176 #define CMD_EDM_UNKcxx . . $ `src/cups/backend_hiti.c:176:9`! 0xE028 /* XX Called if ERC_RTCV is supported. */
177 #define CMD_EDM_C_MC2CEScxx . . $ `src/cups/backend_hiti.c:177:9`! 0xE02E /* CS Move card to Contact Encoder Station */
178 #define CMD_EDM_C_MC2MEScxx . . $ `src/cups/backend_hiti.c:178:9`! 0xE02F /* CS Move card to Mag Encoder Station */
179 #define CMD_EDM_C_MC2CLEScxx . . $ `src/cups/backend_hiti.c:179:9`! 0xE030 /* CS Move card to ContactLess Encoder Station */
180 #define CMD_EDM_C_MC2EBcxx . . $ `src/cups/backend_hiti.c:180:9`! 0xE031 /* CS Move card to Eject Box */
181 #define CMD_EDM_C_MC2Hcxx . . $ `src/cups/backend_hiti.c:181:9`! 0xE037 /* CS Move card to Hopper */
182
183 #define CMD_UNK_UNKcxx . . $ `src/cups/backend_hiti.c:183:9`! 0xE200
184
185 /* CMD_PCC_RP */
186 #define RESET_PRINTERcxx . . $ `src/cups/backend_hiti.c:186:9`! 0x01
187 #define RESET_SOFTcxx . . $ `src/cups/backend_hiti.c:187:9`! 0x02
188
189 /* 801C --> 0 args
190 <-- 6 bytes: 00 YY MM CC 00 00 (YMC is +- 31 decimal)
191
192 840E --> 5 args: YY MM CC 00 00 (YMC is +- 31 decimal)
193 <-- 1 arg: 00 (success, presumably)
194
195 Highlight Correction. Unclear if it's used by printer or by "driver"
196
197 */
198
199 /* CMD_ERDC_RCC */
200 struct hiti_calibrationcxx . . $ hiti_calibration# {
201 uint8_tcxx . . $ uint8_t# colscxx . . $ hiti_calibration#cols.;
202 uint8_tcxx . . $ uint8_t# rowscxx . . $ hiti_calibration#rows.;
203 } __attribute__((packed));
204
205 /* CMD_EDRC_RHTV */
206 struct hiti_rhtvcxx . . $ hiti_rhtv# {
207 uint16_tcxx . . $ uint16_t# majorcxx . . $ hiti_rhtv#major.;
208 uint16_tcxx . . $ uint16_t# minorcxx . . $ hiti_rhtv#minor.;
209 } __attribute__((packed));
210
211 /* CMD_ERDC_RPIDM */
212 struct hiti_rpidmcxx . . $ hiti_rpidm# {
213 uint16_tcxx . . $ uint16_t# usb_pidcxx . . $ hiti_rpidm#usb_pid.; /* BE */
214 uint8_tcxx . . $ uint8_t# regioncxx . . $ hiti_rpidm#region.; /* See hiti_regions, fixed at 01 on P52x and P630 */
215 } __attribute__((packed));
216
217 /* CMD_EDRC_RS */
218 struct hiti_erdc_rscxx . . $ hiti_erdc_rs# { /* All are BIG endian */
219 uint8_tcxx . . $ uint8_t# tph_segcxx . . $ hiti_erdc_rs#tph_seg.; // Always 0x1e?
220 uint16_tcxx . . $ uint16_t# stridecxx . . $ hiti_erdc_rs#stride.; /* Head width: 1920 (6" models) 1280 (4" models) */
221 uint16_tcxx . . $ uint16_t# dpi_colscxx . . $ hiti_erdc_rs#dpi_cols.; /* fixed at 300 */
222 uint16_tcxx . . $ uint16_t# dpi_rowscxx . . $ hiti_erdc_rs#dpi_rows.; /* fixed at 300 */
223 uint16_tcxx . . $ uint16_t# colscxx . . $ hiti_erdc_rs#cols.; /* fixed at the printer's max print size width (eg 1844 for all 6" models) */
224 uint16_tcxx . . $ uint16_t# rowscxx . . $ hiti_erdc_rs#rows.; /* 1240 for 6x4" media */
225 uint16_tcxx . . $ uint16_t# vertUnitInstalledcxx . . $ hiti_erdc_rs#vertUnitInstalled.; // 0xa055 for P510S, 0xffff for rest
226 uint8_tcxx . . $ uint8_t# y_speedcxx . . $ hiti_erdc_rs#y_speed.; /* Varies based on model, units unknown */
227 uint8_tcxx . . $ uint8_t# m_speedcxx . . $ hiti_erdc_rs#m_speed.;
228 uint8_tcxx . . $ uint8_t# c_speedcxx . . $ hiti_erdc_rs#c_speed.;
229 uint8_tcxx . . $ uint8_t# o_speedcxx . . $ hiti_erdc_rs#o_speed.;
230 uint8_tcxx . . $ uint8_t# overheatTempcxx . . $ hiti_erdc_rs#overheatTemp.;
231 uint8_tcxx . . $ uint8_t# heaterOffTempcxx . . $ hiti_erdc_rs#heaterOffTemp.;
232 uint8_tcxx . . $ uint8_t# hwFeature1cxx . . $ hiti_erdc_rs#hwFeature1.; // P52x bit 7 means Toshiba ("RI1") printhead
233 uint8_tcxx . . $ uint8_t# fwFeature1cxx . . $ hiti_erdc_rs#fwFeature1.; // bit 7 means KO function
234 uint8_tcxx . . $ uint8_t# preheatTempcxx . . $ hiti_erdc_rs#preheatTemp.;
235
236 // These might not be present */
237
238 uint16_tcxx . . $ uint16_t# dpi_rows2cxx . . $ hiti_erdc_rs#dpi_rows2.; /* 0x5c08 p520l/p510s */
239 uint16_tcxx . . $ uint16_t# dpi_rows3cxx . . $ hiti_erdc_rs#dpi_rows3.; /* 0x0020 p461 */
240 uint8_tcxx . . $ uint8_t# hwFeature2cxx . . $ hiti_erdc_rs#hwFeature2.; // 64/64/40/20 p630/520l/510s/p461
241 uint8_tcxx . . $ uint8_t# overheatTempScxx . . $ hiti_erdc_rs#overheatTempS.;
242 uint8_tcxx . . $ uint8_t# overheatTempOTcxx . . $ hiti_erdc_rs#overheatTempOT.;
243 } __attribute__((packed));
244
245 /* CMD_JC_* */
246 struct hiti_jobcxx . . $ hiti_job# {
247 uint8_tcxx . . $ uint8_t# luncxx . . $ hiti_job#lun.; /* Logical Unit Number. Leave at 0 */
248 uint16_tcxx . . $ uint16_t# jobidcxx . . $ hiti_job#jobid.; /* BE */
249 } __attribute__((packed));
250
251 /* CMD_JC_QQA */
252 #define MAX_JOBScxx . . $ `src/cups/backend_hiti.c:252:9`! 4
253 struct hiti_job_qqacxx . . $ hiti_job_qqa# {
254 uint8_tcxx . . $ uint8_t# countcxx . . $ hiti_job_qqa#count.; /* 0-MAX_JOBS */
255 structcxx . . $ hiti_job_qqa#$anonymous_type_0# {
256 struct hiti_jobcxx . . $ hiti_job# jobcxx . . $ hiti_job_qqa#$anonymous_type_0#job.;
257 uint8_tcxx . . $ uint8_t# statuscxx . . $ hiti_job_qqa#$anonymous_type_0#status.;
258 } rowcxx . . $ hiti_job_qqa#row.[MAX_JOBScxx . . $ `src/cups/backend_hiti.c:252:9`!]; /* Four jobs max outstanding */
259 } __attribute__((packed));
260
261 #define QQA_STATUS_PRINTINGcxx . . $ `src/cups/backend_hiti.c:261:9`! 0x00
262 #define QQA_STATUS_WAITINGcxx . . $ `src/cups/backend_hiti.c:262:9`! 0x01
263 #define QQA_STATUS_SUSPENDEDcxx . . $ `src/cups/backend_hiti.c:263:9`! 0x03
264 #define QQA_STATUS_ERRORcxx . . $ `src/cups/backend_hiti.c:264:9`! 0x80 // ???
265
266 /* CMD_JC_QJC */
267 struct hiti_jc_qjccxx . . $ hiti_jc_qjc# {
268 uint8_tcxx . . $ uint8_t# luncxx . . $ hiti_jc_qjc#lun.; /* Logical Unit Number. Leave at 0 */
269 uint16_tcxx . . $ uint16_t# jobidcxx . . $ hiti_jc_qjc#jobid.; /* BE */
270 uint16_tcxx . . $ uint16_t# jobid2cxx . . $ hiti_jc_qjc#jobid2.; /* BE, set to 1? */
271 } __attribute__((packed));
272 // repsonse is 6 bytes.
273
274 // Roll Type:
275 // 5x3.5 1547 1072
276 // 6x4 1844 1240
277 // 6x4b 1844 1216 /" 6x3.94"
278 // 6x9 1844 2740
279 // 6x8/2 1844 2492
280 // 6x8 1844 2434
281 // 5x7 1548 2140
282 // 5x7/2 1548 2152
283 // 6x4/2 1844 1248
284 // 6x6 1844 1844
285 // 5x5 1540 1540 ? (1548?)
286 // 6x5 1844 1544
287 // 6x2 1844 ????
288
289 // Sheet type:
290 // 6x4 1818 1280
291
292 #define PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! 0
293 #define PRINT_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:293:9`! 2
294 #define PRINT_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:294:9`! 3
295 #define PRINT_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:295:9`! 6
296 #define PRINT_TYPE_6x9_2UPcxx . . $ `src/cups/backend_hiti.c:296:9`! 7
•297 #define PRINT_TYPE_5x3_5cxx . . $ `src/cups/backend_hiti.c:297:9`! 8 // "5x3.74" ??
298 #define PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! 9
299 #define PRINT_TYPE_6x2cxx . . $ `src/cups/backend_hiti.c:299:9`! 10
300 #define PRINT_TYPE_5x7_2UPcxx . . $ `src/cups/backend_hiti.c:300:9`! 11
301 #define PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`! 16 // ("4x6-split_3up")
302 #define PRINT_TYPE_6x9_4UPcxx . . $ `src/cups/backend_hiti.c:302:9`! 17 // ("6x9-2up2split")
303 #define PRINT_TYPE_6x9_6UPcxx . . $ `src/cups/backend_hiti.c:303:9`! 24 // ("6x9-2up3split")
304 #define PRINT_TYPE_6x5cxx . . $ `src/cups/backend_hiti.c:304:9`! 20
305 #define PRINT_TYPE_6x6cxx . . $ `src/cups/backend_hiti.c:305:9`! 21
•306 #define PRINT_TYPE_5x5cxx . . $ `src/cups/backend_hiti.c:306:9`! 23
307
308 struct hiti_heattable_hdr_v1cxx . . $ hiti_heattable_hdr_v1# { /* P51x */
309 uint8_tcxx . . $ uint8_t# typecxx . . $ hiti_heattable_hdr_v1#type.;
310 uint32_tcxx . . $ uint32_t# lencxx . . $ hiti_heattable_hdr_v1#len.; /* Length in 16-bit words, LE */
311 } __attribute((packed));
312
313 #define HITI_HEATTABLE_V1_Ycxx . . $ `src/cups/backend_hiti.c:313:9`! 0x01
314 #define HITI_HEATTABLE_V1_Mcxx . . $ `src/cups/backend_hiti.c:314:9`! 0x02
315 #define HITI_HEATTABLE_V1_Ccxx . . $ `src/cups/backend_hiti.c:315:9`! 0x03
316 #define HITI_HEATTABLE_V1_Ucxx . . $ `src/cups/backend_hiti.c:316:9`! 0x04 // XXX unknown, maybe K?
317 #define HITI_HEATTABLE_V1_Ocxx . . $ `src/cups/backend_hiti.c:317:9`! 0x05
318 #define HITI_HEATTABLE_V1_OMcxx . . $ `src/cups/backend_hiti.c:318:9`! 0x07
319 #define HITI_HEATTABLE_V1_CVDcxx . . $ `src/cups/backend_hiti.c:319:9`! 0x08
320
321 #define HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`! 2050
322 #define HITI_HEATTABLE_V1_CVDSIZEcxx . . $ `src/cups/backend_hiti.c:322:9`! 582
323
324 /* All fields are little endian */
325 struct hiti_heattable_entry_v2cxx . . $ hiti_heattable_entry_v2# {
326 uint8_tcxx . . $ uint8_t# typecxx . . $ hiti_heattable_entry_v2#type.;
327 uint32_tcxx . . $ uint32_t# lencxx . . $ hiti_heattable_entry_v2#len.; /* in 16-bit words */
328 uint32_tcxx . . $ uint32_t# offsetcxx . . $ hiti_heattable_entry_v2#offset.;
329 } __attribute((packed));
330
331 struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# {
332 uint8_tcxx . . $ uint8_t# num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers.;
333 struct hiti_heattable_entry_v2cxx . . $ hiti_heattable_entry_v2# entriescxx . . $ hiti_heattable_hdr_v2#entries.[];
334 } __attribute((packed));
335
336 #define HEATTABLE_V2_MAX_SIZEcxx . . $ `src/cups/backend_hiti.c:336:9`! (1024*4096) /* P630 has 3.6MB tables! */
337
338 #define HEATTABLE_S_SIZEcxx . . $ `src/cups/backend_hiti.c:338:9`! 4167 /* P461, P310, and some P32x */
339 #define HEATTABLE_S2_SIZEcxx . . $ `src/cups/backend_hiti.c:339:9`! 4232 /* Some P32x */
340 // size
341 #define HEATTABLE_V2_ID_HT_D_Ycxx . . $ `src/cups/backend_hiti.c:341:9`! 0x01 // 522
342 #define HEATTABLE_V2_ID_HT_D_Mcxx . . $ `src/cups/backend_hiti.c:342:9`! 0x02 //
343 #define HEATTABLE_V2_ID_HT_D_Ccxx . . $ `src/cups/backend_hiti.c:343:9`! 0x03 //
344 #define HEATTABLE_V2_ID_HT_D_Kcxx . . $ `src/cups/backend_hiti.c:344:9`! 0x04 //
345 #define HEATTABLE_V2_ID_HT_R_RKcxx . . $ `src/cups/backend_hiti.c:345:9`! 0x10 //
346 #define HEATTABLE_V2_ID_HT_R_Rcxx . . $ `src/cups/backend_hiti.c:346:9`! 0x11 //
347 #define HEATTABLE_V2_ID_HT_R_Lcxx . . $ `src/cups/backend_hiti.c:347:9`! 0x12 //
348 #define HEATTABLE_V2_ID_HT_R_FOcxx . . $ `src/cups/backend_hiti.c:348:9`! 0x13 //
349 #define HEATTABLE_V2_ID_HT_D_Ocxx . . $ `src/cups/backend_hiti.c:349:9`! 0x20 //
350 #define HEATTABLE_V2_ID_HT_D_KOcxx . . $ `src/cups/backend_hiti.c:350:9`! 0x21 //
351 #define HEATTABLE_V2_ID_HT_D_MOcxx . . $ `src/cups/backend_hiti.c:351:9`! 0x22 //
352 #define HEATTABLE_V2_ID_CVDcxx . . $ `src/cups/backend_hiti.c:352:9`! 0x40 // 582
353 #define HEATTABLE_V2_ID_VER_MAJORcxx . . $ `src/cups/backend_hiti.c:353:9`! 0x50 // 4
354 #define HEATTABLE_V2_ID_VER_MINORcxx . . $ `src/cups/backend_hiti.c:354:9`! 0x51 //
355 #define HEATTABLE_V2_ID_CT_INVERTcxx . . $ `src/cups/backend_hiti.c:355:9`! 0x80 // 2562
356 #define HEATTABLE_V2_ID_CT_CLASSICcxx . . $ `src/cups/backend_hiti.c:356:9`! 0x81 //
357 #define HEATTABLE_V2_ID_CT_IDPASScxx . . $ `src/cups/backend_hiti.c:357:9`! 0x82 //
358 #define HEATTABLE_V2_ID_TC_COMPENSATEcxx . . $ `src/cups/backend_hiti.c:358:9`! 0x90 // 26
359 #define HEATTABLE_V2_ID_HAC_Ycxx . . $ `src/cups/backend_hiti.c:359:9`! 0xa1 // 1540
360 #define HEATTABLE_V2_ID_HAC_Mcxx . . $ `src/cups/backend_hiti.c:360:9`! 0xa2 //
361 #define HEATTABLE_V2_ID_HAC_Ccxx . . $ `src/cups/backend_hiti.c:361:9`! 0xa3 //
362 #define HEATTABLE_V2_ID_HAC_DKcxx . . $ `src/cups/backend_hiti.c:362:9`! 0xa4 //
363 #define HEATTABLE_V2_ID_HAC_RKcxx . . $ `src/cups/backend_hiti.c:363:9`! 0xa5 //
364 #define HEATTABLE_V2_ID_HAC_Rcxx . . $ `src/cups/backend_hiti.c:364:9`! 0xa6 //
365 #define HEATTABLE_V2_ID_HAC_Ocxx . . $ `src/cups/backend_hiti.c:365:9`! 0xa7 //
366 #define HEATTABLE_V2_ID_HAC_MOcxx . . $ `src/cups/backend_hiti.c:366:9`! 0xa8 //
367 #define HEATTABLE_V2_ID_HAC_FOcxx . . $ `src/cups/backend_hiti.c:367:9`! 0xa9 //
368 #define HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`! 0xae //
369 #define HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`! 0xaf //
370 #define HEATTABLE_V2_ID_LS_Ycxx . . $ `src/cups/backend_hiti.c:370:9`! 0xb1 // 24 (Long Smear)
371 #define HEATTABLE_V2_ID_LS_Mcxx . . $ `src/cups/backend_hiti.c:371:9`! 0xb2 //
372 #define HEATTABLE_V2_ID_LS_Ccxx . . $ `src/cups/backend_hiti.c:372:9`! 0xb3 //
373 #define HEATTABLE_V2_ID_LS_DKcxx . . $ `src/cups/backend_hiti.c:373:9`! 0xb4 //
374 #define HEATTABLE_V2_ID_LS_RKcxx . . $ `src/cups/backend_hiti.c:374:9`! 0xb5 //
375 #define HEATTABLE_V2_ID_LS_Rcxx . . $ `src/cups/backend_hiti.c:375:9`! 0xb6 //
376 #define HEATTABLE_V2_ID_LS_Ocxx . . $ `src/cups/backend_hiti.c:376:9`! 0xb7 //
377 #define HEATTABLE_V2_ID_LS_MOcxx . . $ `src/cups/backend_hiti.c:377:9`! 0xb8 //
378 #define HEATTABLE_V2_ID_LS_FOcxx . . $ `src/cups/backend_hiti.c:378:9`! 0xb9 //
379 #define HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`! 0xbe //
380 #define HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`! 0xbf //
381 #define HEATTABLE_V2_ID_GL_Ycxx . . $ `src/cups/backend_hiti.c:381:9`! 0xc1 // ?? (Ghost Line)
382 #define HEATTABLE_V2_ID_GL_Mcxx . . $ `src/cups/backend_hiti.c:382:9`! 0xc2 //
383 #define HEATTABLE_V2_ID_GL_Ccxx . . $ `src/cups/backend_hiti.c:383:9`! 0xc3 //
384 #define HEATTABLE_V2_ID_GL_DKcxx . . $ `src/cups/backend_hiti.c:384:9`! 0xc4 //
385 #define HEATTABLE_V2_ID_GL_RKcxx . . $ `src/cups/backend_hiti.c:385:9`! 0xc5 //
386 #define HEATTABLE_V2_ID_GL_Rcxx . . $ `src/cups/backend_hiti.c:386:9`! 0xc6 //
387 #define HEATTABLE_V2_ID_GL_Ocxx . . $ `src/cups/backend_hiti.c:387:9`! 0xc7 //
388 #define HEATTABLE_V2_ID_GL_MOcxx . . $ `src/cups/backend_hiti.c:388:9`! 0xc8 //
389 #define HEATTABLE_V2_ID_GL_FOcxx . . $ `src/cups/backend_hiti.c:389:9`! 0xc9 //
390 #define HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`! 0xce //
391 #define HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`! 0xcf //
392 #define HEATTABLE_V2_ID_EN_Ycxx . . $ `src/cups/backend_hiti.c:392:9`! 0xd1 // 18 (Energy)
393 #define HEATTABLE_V2_ID_EN_Mcxx . . $ `src/cups/backend_hiti.c:393:9`! 0xd2 //
394 #define HEATTABLE_V2_ID_EN_Ccxx . . $ `src/cups/backend_hiti.c:394:9`! 0xd3 //
395 #define HEATTABLE_V2_ID_EN_DKcxx . . $ `src/cups/backend_hiti.c:395:9`! 0xd4 //
396 #define HEATTABLE_V2_ID_EN_RKcxx . . $ `src/cups/backend_hiti.c:396:9`! 0xd5 //
397 #define HEATTABLE_V2_ID_EN_Rcxx . . $ `src/cups/backend_hiti.c:397:9`! 0xd6 //
398 #define HEATTABLE_V2_ID_EN_Ocxx . . $ `src/cups/backend_hiti.c:398:9`! 0xd7 //
399 #define HEATTABLE_V2_ID_EN_MOcxx . . $ `src/cups/backend_hiti.c:399:9`! 0xd8 //
400 #define HEATTABLE_V2_ID_EN_FOcxx . . $ `src/cups/backend_hiti.c:400:9`! 0xd9 //
401 #define HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`! 0xde //
402 #define HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`! 0xdf //
403 #define HEATTABLE_V2_ID_OP1cxx . . $ `src/cups/backend_hiti.c:403:9`! 0xf1 // rp only so far
404 #define HEATTABLE_V2_ID_OP2cxx . . $ `src/cups/backend_hiti.c:404:9`! 0xf2 // rp only so far
405 #define HEATTABLE_V2_ID_SMEARcxx . . $ `src/cups/backend_hiti.c:405:9`! 0xf3 // rp only so far
406 #define HEATTABLE_V2_ID_MSKL_RATEcxx . . $ `src/cups/backend_hiti.c:406:9`! 0xf4 // rp only so far
407
408 #define HEATTABLE_V2_ID_EMBEDDEDcxx . . $ `src/cups/backend_hiti.c:408:9`! 0xf0 // 2
409 #define HEATTABLE_V2_ID_EMBEDDED_1cxx . . $ `src/cups/backend_hiti.c:409:9`! 0x00 // varies
410 #define HEATTABLE_V2_ID_EMBEDDED_2cxx . . $ `src/cups/backend_hiti.c:410:9`! 0x20 // varies
411
412 /* All fields are LE */
413 struct hiti_gpjobhdrcxx . . $ hiti_gpjobhdr# {
414 uint32_tcxx . . $ uint32_t# cookiecxx . . $ hiti_gpjobhdr#cookie.; /* "GPHT" */
415 uint32_tcxx . . $ uint32_t# hdr_lencxx . . $ hiti_gpjobhdr#hdr_len.; /* Including the whole thing */
416 uint32_tcxx . . $ uint32_t# modelcxx . . $ hiti_gpjobhdr#model.; /* Model family, in decimal */
417 uint32_tcxx . . $ uint32_t# colscxx . . $ hiti_gpjobhdr#cols.;
418 uint32_tcxx . . $ uint32_t# rowscxx . . $ hiti_gpjobhdr#rows.;
419 uint32_tcxx . . $ uint32_t# col_dpicxx . . $ hiti_gpjobhdr#col_dpi.;
420 uint32_tcxx . . $ uint32_t# row_dpicxx . . $ hiti_gpjobhdr#row_dpi.;
421 uint32_tcxx . . $ uint32_t# copiescxx . . $ hiti_gpjobhdr#copies.;
422 uint32_tcxx . . $ uint32_t# qualitycxx . . $ hiti_gpjobhdr#quality.; /* 0 for std, 1 for fine */
423 uint32_tcxx . . $ uint32_t# codecxx . . $ hiti_gpjobhdr#code.; /* PRINT_TYPE_* */
424 uint32_tcxx . . $ uint32_t# overcoatcxx . . $ hiti_gpjobhdr#overcoat.; /* 1 for matte, 0 for glossy */
425 uint32_tcxx . . $ uint32_t# payload_flagcxx . . $ hiti_gpjobhdr#payload_flag.; /* See PAYLOAD_FLAG_* */
426 uint32_tcxx . . $ uint32_t# payload_lencxx . . $ hiti_gpjobhdr#payload_len.;
427 } __attribute__((packed));
428
429 #define PAYLOAD_FLAG_YMCPLANARcxx . . $ `src/cups/backend_hiti.c:429:9`! 0x01
430 #define PAYLOAD_FLAG_NOCORRECTcxx . . $ `src/cups/backend_hiti.c:430:9`! 0x02
431 #define PAYLOAD_FLAG_MEDIAVERcxx . . $ `src/cups/backend_hiti.c:431:9`! 0x04
432 #define PAYLOAD_FLAG_MEDIATYPEcxx . . $ `src/cups/backend_hiti.c:432:9`! 0x08
433
434 #define PAYLOAD_FLAG_DATA_SHIFTcxx . . $ `src/cups/backend_hiti.c:434:9`! 24
435
436 #define HDR_COOKIEcxx . . $ `src/cups/backend_hiti.c:436:9`! 0x54485047
437
438 /* CMD_EFD_SF for non-CS systems */
439 struct hiti_efd_sfcxx . . $ hiti_efd_sf# {
440 /*@0 */ uint8_tcxx . . $ uint8_t# mediaTypecxx . . $ hiti_efd_sf#mediaType.; /* PRINT_TYPE_?? */
441 /*@1 */ uint16_tcxx . . $ uint16_t# cols_rescxx . . $ hiti_efd_sf#cols_res.; /* BE, always 300dpi */
442 /*@3 */ uint16_tcxx . . $ uint16_t# rows_rescxx . . $ hiti_efd_sf#rows_res.; /* BE, always 300dpi */
443 /*@5 */ uint16_tcxx . . $ uint16_t# colscxx . . $ hiti_efd_sf#cols.; /* BE */
444 /*@7 */ uint16_tcxx . . $ uint16_t# rowscxx . . $ hiti_efd_sf#rows.; /* BE */
445 /*@9 */ int8_tcxx . . $ int8_t# cols_offsetcxx . . $ hiti_efd_sf#cols_offset.; /* Has to do with H_Offset calibration */
446 /*@10*/ int8_tcxx . . $ int8_t# rows_offsetcxx . . $ hiti_efd_sf#rows_offset.; /* Has to do wiwth V_Offset calibration */
447 /*@11*/ uint8_tcxx . . $ uint8_t# colorSeqcxx . . $ hiti_efd_sf#colorSeq.; /* See SF_COLORSEQ_* */
448 /*@12*/ uint8_tcxx . . $ uint8_t# copiescxx . . $ hiti_efd_sf#copies.;
449 /*@13*/ uint8_tcxx . . $ uint8_t# printModecxx . . $ hiti_efd_sf#printMode.; /* See SF_PRINTMODE_* */
450 /*@14*/ uint8_tcxx . . $ uint8_t# zerocxx . . $ hiti_efd_sf#zero.[4]; /* P461, U826, P630 only? */
451 } __attribute__((packed));
452
453 /* SF_COLORSEQ is actually:
454
455 Y 0x01
456 M 0x02
457 C 0x04
458 DK 0x08 (Dye Black)
459 RK 0x10 (Resin Black)
460 OM 0x20 (NOT CSxxx models)
461 O 0x80 (On CSxx, means there is an explicit O plane)
462 */
463 #define SF_COLORSEQ_YMCOcxx . . $ `src/cups/backend_hiti.c:463:9`! 0x87
464 #define SF_COLORSEQ_MATTEcxx . . $ `src/cups/backend_hiti.c:464:9`! 0xC0
465
466 #define SF_PRINTMODE_NORMALcxx . . $ `src/cups/backend_hiti.c:466:9`! 0x00
467 #define SF_PRINTMODE_SPLITKcxx . . $ `src/cups/backend_hiti.c:467:9`! 0x01 /* CSxxx only */
468 #define SF_PRINTMODE_FINEcxx . . $ `src/cups/backend_hiti.c:468:9`! 0x02 /* For P5xx/P7xx only */
469 #define SF_PRINTMODE_BASEcxx . . $ `src/cups/backend_hiti.c:469:9`! 0x08 /* For P5xx/P7xx only */
470 #define SF_PRINTMODE_OBHEATcxx . . $ `src/cups/backend_hiti.c:470:9`! 0x10 /* Onboard Heat Comp, CSxxx only */
471
472 /* CMD_ESD_SEPD -- Note it's different from the usual command flow */
473 struct hiti_extprintdatacxx . . $ hiti_extprintdata# {
474 uint8_tcxx . . $ uint8_t# hdrcxx . . $ hiti_extprintdata#hdr.; /* 0xa5 */
475 uint16_tcxx . . $ uint16_t# lencxx . . $ hiti_extprintdata#len.; /* 24bit data length (+8) in BE format, first two bytes */
476 uint8_tcxx . . $ uint8_t# flagcxx . . $ hiti_extprintdata#flag.; /* 0x50 */
477 uint16_tcxx . . $ uint16_t# cmdcxx . . $ hiti_extprintdata#cmd.; /* 0x8309, BE */
478 uint8_tcxx . . $ uint8_t# lenbcxx . . $ hiti_extprintdata#lenb.; /* LSB of length */
479 uint16_tcxx . . $ uint16_t# startLinecxx . . $ hiti_extprintdata#startLine.; /* Starting line number, BE */
480 uint16_tcxx . . $ uint16_t# numLinescxx . . $ hiti_extprintdata#numLines.; /* Number of lines in block, BE, 3000 max. */
481 uint8_tcxx . . $ uint8_t# payloadcxx . . $ hiti_extprintdata#payload.[]; /* ie data length bytes */
482 } __attribute__((packed));
483
484 /* CMD_ESD_SEHT2 -- Note it's different from the usual command flow */
485 struct hiti_seht2cxx . . $ hiti_seht2# {
486 uint8_tcxx . . $ uint8_t# hdrcxx . . $ hiti_seht2#hdr.; /* 0xa5 */
487 uint16_tcxx . . $ uint16_t# lencxx . . $ hiti_seht2#len.; /* 24-bit data length (+5) in BE format, first two bytes */
488 uint8_tcxx . . $ uint8_t# flagcxx . . $ hiti_seht2#flag.; /* 0x50 */
489 uint16_tcxx . . $ uint16_t# cmdcxx . . $ hiti_seht2#cmd.; /* 0x8303, BE */
490 uint8_tcxx . . $ uint8_t# lenbcxx . . $ hiti_seht2#lenb.; /* LSB of length */
491 uint8_tcxx . . $ uint8_t# planecxx . . $ hiti_seht2#plane.;
492 } __attribute__((packed));
493
494 /* All multi-byte fields here are LE */
495 struct hiti_matrixcxx . . $ hiti_matrix# {
496 /*@00*/ uint8_tcxx . . $ uint8_t# row0cxx . . $ hiti_matrix#row0.[16]; // all 00
497
498 /*@10*/ uint8_tcxx . . $ uint8_t# row1cxx . . $ hiti_matrix#row1.[6]; // 01 00 00 00 00 00
499 uint16_tcxx . . $ uint16_t# cuttercountcxx . . $ hiti_matrix#cuttercount.;
500 uint8_tcxx . . $ uint8_t# align_vcxx . . $ hiti_matrix#align_v.;
501 uint8_tcxx . . $ uint8_t# aligh_hcxx . . $ hiti_matrix#aligh_h.;
502 uint8_tcxx . . $ uint8_t# row1_2cxx . . $ hiti_matrix#row1_2.[6]; // all 00
503
504 /*@20*/ uint8_tcxx . . $ uint8_t# row2cxx . . $ hiti_matrix#row2.[16]; // no idea
505
506 /*@30*/ uint8_tcxx . . $ uint8_t# error_index0cxx . . $ hiti_matrix#error_index0.; /* Value % 31 == NEWEST. Count back */
507 uint8_tcxx . . $ uint8_t# errorcodecxx . . $ hiti_matrix#errorcode.[31];
508
509 /*@50*/ uint8_tcxx . . $ uint8_t# row5cxx . . $ hiti_matrix#row5.[16]; // all 00, except [8] which is a5.
510 /*@60*/ char sernocxx . . $ hiti_matrix#serno.[16]; /* device serial number */
511
512 /*@70*/ uint16_tcxx . . $ uint16_t# unclean_printscxx . . $ hiti_matrix#unclean_prints.;
513 uint16_tcxx . . $ uint16_t# cleanatcxx . . $ hiti_matrix#cleanat.[15]; // XX Guess?
514
515 /*@90*/ uint16_tcxx . . $ uint16_t# supply_motorcxx . . $ hiti_matrix#supply_motor.;
516 uint16_tcxx . . $ uint16_t# take_motorcxx . . $ hiti_matrix#take_motor.;
517 uint8_tcxx . . $ uint8_t# row9cxx . . $ hiti_matrix#row9.[12]; // all 00 except last, which is 0xa5
518
519 /*@a0*/ uint16_tcxx . . $ uint16_t# errorcountcxx . . $ hiti_matrix#errorcount.[31];
520 uint8_tcxx . . $ uint8_t# rowdcxx . . $ hiti_matrix#rowd.[2]; // seems to be 00 cc ?
521
522 /*@e0*/ uint16_tcxx . . $ uint16_t# tpc_4x6cxx . . $ hiti_matrix#tpc_4x6.;
523 uint16_tcxx . . $ uint16_t# tpc_5x7cxx . . $ hiti_matrix#tpc_5x7.;
524 uint16_tcxx . . $ uint16_t# tpc_6x8cxx . . $ hiti_matrix#tpc_6x8.;
525 uint16_tcxx . . $ uint16_t# tpc_6x9cxx . . $ hiti_matrix#tpc_6x9.;
526 uint8_tcxx . . $ uint8_t# unk_rowecxx . . $ hiti_matrix#unk_rowe.[8]; // all 00
527
528 /*@f0*/ uint16_tcxx . . $ uint16_t# apc_4x6cxx . . $ hiti_matrix#apc_4x6.;
529 uint16_tcxx . . $ uint16_t# apc_5x7cxx . . $ hiti_matrix#apc_5x7.;
530 uint16_tcxx . . $ uint16_t# apc_6x8cxx . . $ hiti_matrix#apc_6x8.;
531 uint16_tcxx . . $ uint16_t# apc_6x9cxx . . $ hiti_matrix#apc_6x9.;
532 uint8_tcxx . . $ uint8_t# unk_rowfcxx . . $ hiti_matrix#unk_rowf.[4]; // all 00
533 uint8_tcxx . . $ uint8_t# tphv_acxx . . $ hiti_matrix#tphv_a.;
534 uint8_tcxx . . $ uint8_t# tphv_dcxx . . $ hiti_matrix#tphv_d.;
535 uint8_tcxx . . $ uint8_t# unk_rowf2cxx . . $ hiti_matrix#unk_rowf2.[2]; // all 00
536
537 /*@100*/uint8_tcxx . . $ uint8_t# unk_row10cxx . . $ hiti_matrix#unk_row10.[16];
538 /*@110*/uint8_tcxx . . $ uint8_t# unk_row11cxx . . $ hiti_matrix#unk_row11.[16];
539 /*@120*/uint8_tcxx . . $ uint8_t# unk_row12cxx . . $ hiti_matrix#unk_row12.[16];
540 /*@130*/uint8_tcxx . . $ uint8_t# unk_row13cxx . . $ hiti_matrix#unk_row13.[16];
541 /*@140*/uint8_tcxx . . $ uint8_t# unk_row14cxx . . $ hiti_matrix#unk_row14.[16];
542 /*@150*/uint8_tcxx . . $ uint8_t# unk_row15cxx . . $ hiti_matrix#unk_row15.[16];
543 /*@160*/uint8_tcxx . . $ uint8_t# unk_row16cxx . . $ hiti_matrix#unk_row16.[16];
544 /*@170*/uint8_tcxx . . $ uint8_t# unk_row17cxx . . $ hiti_matrix#unk_row17.[16];
545 /*@180*/uint8_tcxx . . $ uint8_t# unk_row18cxx . . $ hiti_matrix#unk_row18.[16];
546 /*@190*/uint8_tcxx . . $ uint8_t# unk_row19cxx . . $ hiti_matrix#unk_row19.[16];
547 /*@1a0*/uint8_tcxx . . $ uint8_t# unk_row1acxx . . $ hiti_matrix#unk_row1a.[16];
548 /*@1b0*/uint8_tcxx . . $ uint8_t# unk_row1bcxx . . $ hiti_matrix#unk_row1b.[16];
549 /*@1c0*/uint8_tcxx . . $ uint8_t# unk_row1ccxx . . $ hiti_matrix#unk_row1c.[16];
550 /*@1d0*/uint8_tcxx . . $ uint8_t# unk_row1dcxx . . $ hiti_matrix#unk_row1d.[16];
551 /*@1e0*/uint8_tcxx . . $ uint8_t# unk_row1ecxx . . $ hiti_matrix#unk_row1e.[16];
552 /*@1f0*/uint8_tcxx . . $ uint8_t# unk_row1fcxx . . $ hiti_matrix#unk_row1f.[16];
553 /*@200*/
554 } __attribute__((packed));
555
556 STATIC_ASSERTcxx . . $ `src/cups/backend_common.h:87:9`!(sizeof(struct hiti_matrix) == 512);
557
558 struct hiti_ribboncxx . . $ hiti_ribbon# {
559 uint16_tcxx . . $ uint16_t# unkcxx . . $ hiti_ribbon#unk.; // 01 08 (p461, u826, p630)
560 uint8_tcxx . . $ uint8_t# typecxx . . $ hiti_ribbon#type.; /* RIBBON_TYPE_XXX */
561 uint16_tcxx . . $ uint16_t# unk2cxx . . $ hiti_ribbon#unk2.; // 00 07 (p461, u826, p630)
562 } __attribute__((packed));
563
564 #define RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`! 0x01
565 #define RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`! 0x02
566 #define RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`! 0x03
567 #define RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`! 0x04
568
569 struct hiti_papercxx . . $ hiti_paper# {
570 uint8_tcxx . . $ uint8_t# unkcxx . . $ hiti_paper#unk.; // 01 on U286 w/6x8
571 uint8_tcxx . . $ uint8_t# typecxx . . $ hiti_paper#type.; /* PAPER_TYPE_XXX */
572 uint16_tcxx . . $ uint16_t# unk2cxx . . $ hiti_paper#unk2.; // 00 07 on U826 w/6x8)
573 } __attribute__((packed));
574
575 #define PAPER_TYPE_X4INCHcxx . . $ `src/cups/backend_hiti.c:575:9`! 0xf0 // XXX hack
576 #define PAPER_TYPE_5INCHcxx . . $ `src/cups/backend_hiti.c:576:9`! 0x02
577 #define PAPER_TYPE_6INCHcxx . . $ `src/cups/backend_hiti.c:577:9`! 0x01
578 #define PAPER_TYPE_NONEcxx . . $ `src/cups/backend_hiti.c:578:9`! 0x00
579
580 /* Private data structure */
581 enumcxx . . $ $anonymous_type_8cc6923eb8cb2078_2# {
582 HT_COLORMODE_NULLcxx . . $ HT_COLORMODE_NULL. = 0,
583 HT_COLORMODE_INVERTcxx . . $ HT_COLORMODE_INVERT. = 1,
584 HT_COLORMODE_CLASSICcxx . . $ HT_COLORMODE_CLASSIC. = 2,
585 HT_COLORMODE_IDPASS_VIVIDcxx . . $ HT_COLORMODE_IDPASS_VIVID. = 3,
586
587 HT_COLORMODE_METALLICcxx . . $ HT_COLORMODE_METALLIC. = 5,
588 HT_COLORMODE_HIGHDENSITYcxx . . $ HT_COLORMODE_HIGHDENSITY. = 6,
589 HT_COLORMODE_TRANSPARENTcxx . . $ HT_COLORMODE_TRANSPARENT. = 7,
590 };
591
592 enumcxx . . $ $anonymous_type_8cc6923eb8cb2078_3# {
593 HT_PLANE_Ycxx . . $ HT_PLANE_Y. = 0x01,
594 HT_PLANE_Mcxx . . $ HT_PLANE_M. = 0x02,
595 HT_PLANE_Ccxx . . $ HT_PLANE_C. = 0x04,
596 HT_PLANE_Kcxx . . $ HT_PLANE_K. = 0x08, // Dye K, eg on YMCKO ribbons?
597 HT_PLANE_OGcxx . . $ HT_PLANE_OG. = 0x10,
598 HT_PLANE_OKcxx . . $ HT_PLANE_OK. = 0x20, // Glossy on YMCKO ribbons
599 HT_PLANE_OMcxx . . $ HT_PLANE_OM. = 0x40,
600 HT_PLANE_RKcxx . . $ HT_PLANE_RK. = 0x100, // Resin K on YMCKO
601 HT_PLANE_Rcxx . . $ HT_PLANE_R. = 0x200, // Resin K only
602 HT_PLANE_FOcxx . . $ HT_PLANE_FO. = 0x400, // Flourescent
603 HT_PLANE_Lcxx . . $ HT_PLANE_L. = 0x800, // Lamination on RESIN K
604 HT_CVDcxx . . $ HT_CVD. = 0x1000,
605 HT_PLANE_630Xcxx . . $ HT_PLANE_630X. = 0x2000, // P630 has several unknown fields
606 };
607
608 struct hiti_printjobcxx . . $ hiti_printjob# {
609 struct dyesub_job_commoncxx . . $ dyesub_job_common# commoncxx . . $ hiti_printjob#common.;
610
611 uint8_tcxx . . $ uint8_t# *databufcxx . . $ hiti_printjob#databuf.;
612 uint32_tcxx . . $ uint32_t# datalencxx . . $ hiti_printjob#datalen.;
613
614 struct hiti_gpjobhdrcxx . . $ hiti_gpjobhdr# hdrcxx . . $ hiti_printjob#hdr.;
615
616 int colormodecxx . . $ hiti_printjob#colormode.;
617
618 uint8_tcxx . . $ uint8_t# *heattable_bufcxx . . $ hiti_printjob#heattable_buf.;
619 int heattable_lencxx . . $ hiti_printjob#heattable_len.;
620
621 struct hiti_heattable_v2cxx . . $ hiti_heattable_v2# {
622 uint8_tcxx . . $ uint8_t# typecxx . . $ hiti_heattable_v2#type.;
623 uint8_tcxx . . $ uint8_t# *datacxx . . $ hiti_heattable_v2#data.;
624 uint32_tcxx . . $ uint32_t# lencxx . . $ hiti_heattable_v2#len.;
625 } *heattable_v2cxx . . $ hiti_printjob#heattable_v2.;
626 uint8_tcxx . . $ uint8_t# num_heattable_entriescxx . . $ hiti_printjob#num_heattable_entries.;
627 };
628
629 enumcxx . . $ $anonymous_type_8cc6923eb8cb2078_4# {
630 HEATTABLE_TYPE_V0cxx . . $ HEATTABLE_TYPE_V0., // P461, P320, P310, passed as-is
631 HEATTABLE_TYPE_V1cxx . . $ HEATTABLE_TYPE_V1., // P51x
632 HEATTABLE_TYPE_V2cxx . . $ HEATTABLE_TYPE_V2., // All others
633 };
634
635 struct hiti_ctxcxx . . $ hiti_ctx# {
636 struct dyesub_connectioncxx . . $ dyesub_connection# *conncxx . . $ hiti_ctx#conn.;
637
638 int jobidcxx . . $ hiti_ctx#jobid.;
639 int nodatacxx . . $ hiti_ctx#nodata.;
640
641 int sheetcxx . . $ hiti_ctx#sheet.;
642 int heattable_typecxx . . $ hiti_ctx#heattable_type.;
643
644 char sernocxx . . $ hiti_ctx#serno.[32];
645
646 int erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.;
647
648 struct markercxx . . $ marker# markercxx . . $ hiti_ctx#marker.;
649 char versioncxx . . $ hiti_ctx#version.[256];
650 char idcxx . . $ hiti_ctx#id.[256];
651 uint8_tcxx . . $ uint8_t# matrixcxx . . $ hiti_ctx#matrix.[512]; // XXX convert to struct matrix */
652 struct hiti_ribboncxx . . $ hiti_ribbon# ribboncxx . . $ hiti_ctx#ribbon.;
653 struct hiti_papercxx . . $ hiti_paper# papercxx . . $ hiti_ctx#paper.;
654 struct hiti_calibrationcxx . . $ hiti_calibration# calibrationcxx . . $ hiti_ctx#calibration.;
655 struct hiti_rhtvcxx . . $ hiti_rhtv# rhtvcxx . . $ hiti_ctx#rhtv.;
656 uint8_tcxx . . $ uint8_t# led_calibrationcxx . . $ hiti_ctx#led_calibration.[10]; // XXX convert to struct
657 uint8_tcxx . . $ uint8_t# unk_8010cxx . . $ hiti_ctx#unk_8010.[17]; // XXX !sheet. 17 on U826+P630, 15 on rest
658 uint8_tcxx . . $ uint8_t# unk_800ccxx . . $ hiti_ctx#unk_800c.[4]; // XXX
659 struct hiti_erdc_rscxx . . $ hiti_erdc_rs# erdc_rscxx . . $ hiti_ctx#erdc_rs.;
660 uint8_tcxx . . $ uint8_t# hilight_adjcxx . . $ hiti_ctx#hilight_adj.[6]; // XXX convert to struct, not P51x!
661 uint8_tcxx . . $ uint8_t# rtlvcxx . . $ hiti_ctx#rtlv.[2]; /* XXX figure out conversion/math? */
662 struct hiti_rpidmcxx . . $ hiti_rpidm# rpidmcxx . . $ hiti_ctx#rpidm.;
663 uint16_tcxx . . $ uint16_t# ribbonvendorcxx . . $ hiti_ctx#ribbonvendor.; // see below.
664 uint32_tcxx . . $ uint32_t# media_remaincxx . . $ hiti_ctx#media_remain.; // XXX could be array?
665 };
666
667 #define RRVC_VENDOR_MASKcxx . . $ `src/cups/backend_hiti.c:667:9`! 0xf000
668 #define RRVC_VERSION_MASKcxx . . $ `src/cups/backend_hiti.c:668:9`! 0x003f
669
670 /* Prototypes */
671 static int hiti_doresetcxx . . $ hiti_doreset(d63471c3d727dc9).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# type);
672 static int hiti_query_job_qacxx . . $ hiti_query_job_qa(962c75e45e54edc0).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, struct hiti_jobcxx . . $ hiti_job# *jobid, struct hiti_job_qqacxx . . $ hiti_job_qqa# *resp);
673 static int hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# *sts, uint32_tcxx . . $ uint32_t# *err);
674 static int hiti_query_versioncxx . . $ hiti_query_version(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
675 static int hiti_query_matrixcxx . . $ hiti_query_matrix(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
676 static int hiti_query_matrix_51xcxx . . $ hiti_query_matrix_51x(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
677 static int hiti_query_suppliescxx . . $ hiti_query_supplies(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
678 static int hiti_query_tphvcxx . . $ hiti_query_tphv(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
679 static int hiti_query_statisticscxx . . $ hiti_query_statistics(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
680 static int hiti_query_calibrationcxx . . $ hiti_query_calibration(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
681 static int hiti_query_led_calibrationcxx . . $ hiti_query_led_calibration(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
682 static int hiti_query_ribbonvendorcxx . . $ hiti_query_ribbonvendor(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
683 static int hiti_query_summarycxx . . $ hiti_query_summary(dae0eb98bf879044).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, struct hiti_erdc_rscxx . . $ hiti_erdc_rs# *rds);
684 static int hiti_query_rpidmcxx . . $ hiti_query_rpidm(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
685 static int hiti_query_hilightadjcxx . . $ hiti_query_hilightadj(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
686 static int hiti_query_unk8010cxx . . $ hiti_query_unk8010(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
687 static int hiti_query_unk800ccxx . . $ hiti_query_unk800c(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx);
688 static int hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# arg, uint32_tcxx . . $ uint32_t# *resp, int num);
689 static int hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).(void *vctx, struct markercxx . . $ marker# **markers, int *count);
690
691 static int hiti_query_sernocxx . . $ hiti_query_serno(a3ebabf18f8093e8).(struct dyesub_connectioncxx . . $ dyesub_connection# *conn, char *buf, int buf_len);
692 static int hiti_parse_heattable_v2cxx . . $ hiti_parse_heattable_v2(6171dc793ae4f88a).(struct hiti_printjobcxx . . $ hiti_printjob# *job);
693 static int hiti_construct_heattable_v2cxx . . $ hiti_construct_heattable_v2(6f0ee2c8f7bc776c).(const struct hiti_printjobcxx . . $ hiti_printjob# *job, int planes, int colormode, struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# *table);
694 static void *hiti_find_heattable_v2_entrycxx . . $ hiti_find_heattable_v2_entry(816ea6d80e1ec686).(const struct hiti_printjobcxx . . $ hiti_printjob# *job, int id, size_t *len);
695
696 static const char* hiti_modelcodecxx . . $ hiti_modelcode(bd5db3388d838e27).(int type, int subtype) {
697 switch (type) {
698 case P_HITI_CS2XXcxx . . $ P_HITI_CS2XX.:
699 return "cd";
700 case P_HITI_310cxx . . $ P_HITI_310.:
701 return "sl";
702 case P_HITI_320cxx . . $ P_HITI_320.:
703 return "sp";
704 case P_HITI_461cxx . . $ P_HITI_461.:
705 return "sn";
706 case P_HITI_51Xcxx . . $ P_HITI_51X.:
707 return "ra";
708 case P_HITI_520cxx . . $ P_HITI_520.:
709 case P_HITI_525cxx . . $ P_HITI_525.:
710 if (subtype)
711 return "ri1";
712 else
713 return "ri";
714 case P_HITI_530cxx . . $ P_HITI_530.:
715 return "rk";
716 case P_HITI_630cxx . . $ P_HITI_630.:
717 return "rp";
718 case P_HITI_720cxx . . $ P_HITI_720.:
719 return "rd";
720 case P_HITI_750cxx . . $ P_HITI_750.:
721 return "rh";
722 case P_HITI_826cxx . . $ P_HITI_826.:
723 if (subtype)
724 return "ro1";
725 else
726 return "ro";
727 case P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10.:
728 if (subtype)
729 return "rq1";
730 else
731 return "rq";
732 default:
733 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unknown HiTi type %d\n", type);
734 return "XX";
735 }
736 }
737
738 static int hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint16_tcxx . . $ uint16_t# cmdid, const uint8_tcxx . . $ uint8_t# *buf, uint16_tcxx . . $ uint16_t# buf_len, uint16_tcxx . . $ uint16_t# *rsplen)
739 {
740 uint8_tcxx . . $ uint8_t# cmdbuf[2048];
741 struct hiti_cmdcxx . . $ hiti_cmd# *cmd = (struct hiti_cmdcxx . . $ hiti_cmd# *)cmdbuf;
742 int ret, num = 0;
743
744 cmd->hdrcxx . . $ hiti_cmd#hdr. = 0xa5;
745 cmd->lencxx . . $ hiti_cmd#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(buf_len + 3);
746 cmd->flagcxx . . $ hiti_cmd#flag. = (CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! | CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`!);
747 cmd->cmdcxx . . $ hiti_cmd#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(cmdid);
748 if (buf && buf_len)
749 memcpycxx . . $ memcpy(cc817cb175f282d).(cmd->payloadcxx . . $ hiti_cmd#payload., buf, buf_len);
750
751 /* Send over command */
752 if ((ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., (uint8_tcxx . . $ uint8_t#*) cmd, buf_len + 3 + 3))) {
753 return ret;
754 }
755
756 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
757
758 /* Read back command */
759 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., cmdbuf, 6, &num);
760 if (ret)
761 return ret;
762
763 if (num != 6) {
764 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("CMD Readback length mismatch (%d vs %d)!\n", num, 6);
765 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
766 }
767
768 /* Compensate for hdr len */
769 num = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(cmd->len) - 3;
770
771 if (num > *rsplen) {
772 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Response too long for buffer (%d vs %d)!\n", num, *rsplen);
773 *rsplen = 0;
774 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
775 }
776
777 /* Check response */
778 switch (cmd->flagcxx . . $ hiti_cmd#flag. & CMD_FLAG_CHK_MASKcxx . . $ `src/cups/backend_hiti.c:62:9`!) {
779 case CMD_FLAG_CHK_OKcxx . . $ `src/cups/backend_hiti.c:63:9`!:
780 break;
781 case CMD_FLAG_CHK_REJECTEDcxx . . $ `src/cups/backend_hiti.c:64:9`!:
782 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Command %04x rejected, code %02x\n", cmdid, cmd->flag);
783 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
784 case CMD_FLAG_CHK_DATAERRcxx . . $ `src/cups/backend_hiti.c:65:9`!:
785 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Command %04x Data Error, code %02x\n", cmdid, cmd->flag);
786 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
787 case CMD_FLAG_CHK_CMDERRcxx . . $ `src/cups/backend_hiti.c:66:9`!:
788 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Command %04x Data Error, code %02x\n", cmdid, cmd->flag);
789 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
790 default:
791 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Command %04x failed, code %02x\n", cmdid, cmd->flag);
792 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
793 }
794
795 *rsplen = num;
796
797 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
798 }
799
800 static int hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint16_tcxx . . $ uint16_t# cmdid,
801 const uint8_tcxx . . $ uint8_t# *buf, uint8_tcxx . . $ uint8_t# buf_len,
802 uint8_tcxx . . $ uint8_t# *respbuf, uint16_tcxx . . $ uint16_t# *resplen)
803 {
804 int ret, num = 0;
805 uint16_tcxx . . $ uint16_t# cmd_resp_len = *resplen;
806
807 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, cmdid, buf, buf_len, &cmd_resp_len);
808 if (ret)
809 return ret;
810
811 if (cmd_resp_len > *resplen) {
812 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Response too long! (%d vs %d)\n", cmd_resp_len, *resplen);
813 *resplen = 0;
814 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
815 }
816
817 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
818
819 /* Read back the data*/
820 int remain = *resplen;
821 int total = 0;
822 do {
823 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., respbuf + total, remain, &num);
824 if (ret)
825 return ret;
826 total += num;
827 remain -= num;
828 } while (remain > 0 && num == 64);
829
830 /* Sanity check */
831 if (total > *resplen) {
832 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Response too long for buffer (%d vs %d)!\n", total, *resplen);
833 *resplen = 0;
834 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
835 }
836
837 *resplen = total;
838
839 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
840 }
841
842 static int hiti_shptccxx . . $ hiti_shptc(b1de4f2fc8046d60).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, const uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# buf_len)
843 {
844 uint8_tcxx . . $ uint8_t# cmdbuf[sizeof(struct hiti_cmdcxx . . $ hiti_cmd#) + 1];
845 struct hiti_cmdcxx . . $ hiti_cmd# *cmd = (struct hiti_cmdcxx . . $ hiti_cmd# *)cmdbuf;
846 int cmdsize = 0;
847 int ret, num = 0;
848
849 cmd->hdrcxx . . $ hiti_cmd#hdr. = 0xa5;
850 if (buf_len > 0xffff-3) {
851 cmd->cmdcxx . . $ hiti_cmd#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(CMD_ESD_SHPTC2cxx . . $ `src/cups/backend_hiti.c:157:9`!);
852 cmd->lencxx . . $ hiti_cmd#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!((buf_len + 4) >> 8);
853 cmdbuf[sizeof(struct hiti_cmdcxx . . $ hiti_cmd#)] = (buf_len + 4) & 0xff;
854 cmdsize = sizeof(struct hiti_cmdcxx . . $ hiti_cmd#) + 1;
855 } else {
856 cmd->cmdcxx . . $ hiti_cmd#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(CMD_ESD_SHPTCcxx . . $ `src/cups/backend_hiti.c:156:9`!);
857 cmd->lencxx . . $ hiti_cmd#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(buf_len + 3);
858 cmdsize = sizeof(struct hiti_cmdcxx . . $ hiti_cmd#);
859 }
860 cmd->flagcxx . . $ hiti_cmd#flag. = (CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! | CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`!);
861
862 /* Send over command */
863 if ((ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., (uint8_tcxx . . $ uint8_t#*) cmd, cmdsize))) {
864 return ret;
865 }
866
867 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
868
869 /* Read back command */
870 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., cmdbuf, 6, &num);
871 if (ret)
872 return ret;
873
874 if (num != 6) {
875 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("CMD Readback length mismatch (%d vs %d)!\n", num, 6);
876 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
877 }
878
879 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., buf, buf_len);
880 if (ret)
881 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
882
883 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
884 }
885
886 static int hiti_sepdcxx . . $ hiti_sepd(a6d8e378a3069b49).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint32_tcxx . . $ uint32_t# buf_len,
887 uint16_tcxx . . $ uint16_t# startLine, uint16_tcxx . . $ uint16_t# numLines)
888 {
889 uint8_tcxx . . $ uint8_t# cmdbuf[sizeof(struct hiti_extprintdatacxx . . $ hiti_extprintdata#)];
890 struct hiti_extprintdatacxx . . $ hiti_extprintdata# *cmd = (struct hiti_extprintdatacxx . . $ hiti_extprintdata# *)cmdbuf;
891 int ret, num = 0;
892
893 buf_len += 8;
894
895 cmd->hdrcxx . . $ hiti_extprintdata#hdr. = 0xa5;
896 cmd->lencxx . . $ hiti_extprintdata#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(buf_len >> 8);
897 cmd->flagcxx . . $ hiti_extprintdata#flag. = (CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! | CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`!);
898 cmd->cmdcxx . . $ hiti_extprintdata#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(CMD_ESD_SEPDcxx . . $ `src/cups/backend_hiti.c:154:9`!);
899 cmd->lenbcxx . . $ hiti_extprintdata#lenb. = buf_len & 0xff;
900 cmd->startLinecxx . . $ hiti_extprintdata#startLine. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(startLine);
901 cmd->numLinescxx . . $ hiti_extprintdata#numLines. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(numLines);
902
903 /* Send over command */
904 if ((ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., (uint8_tcxx . . $ uint8_t#*) cmd, sizeof(*cmd)))) {
905 return ret;
906 }
907
908 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
909
910 /* Read back command */
911 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., cmdbuf, 6, &num);
912 if (ret)
913 return ret;
914
915 if (num != 6) {
916 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("CMD Readback length mismatch (%d vs %d)!\n", num, 6);
917 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
918 }
919 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
920 }
921
922 #define STATUS_IDLEcxx . . $ `src/cups/backend_hiti.c:922:9`! 0x00
923 #define STATUS0_POWERONcxx . . $ `src/cups/backend_hiti.c:923:9`! 0x01
924 #define STATUS0_RESEND_DATAcxx . . $ `src/cups/backend_hiti.c:924:9`! 0x04
925 #define STATUS0_BUSYcxx . . $ `src/cups/backend_hiti.c:925:9`! 0x80
926 #define STATUS1_SUPPLIEScxx . . $ `src/cups/backend_hiti.c:926:9`! 0x01
927 #define STATUS1_PAPERJAMcxx . . $ `src/cups/backend_hiti.c:927:9`! 0x02
928 #define STATUS1_INPUTcxx . . $ `src/cups/backend_hiti.c:928:9`! 0x08
929 #define STATUS2_WARNINGcxx . . $ `src/cups/backend_hiti.c:929:9`! 0x02
930 #define STATUS2_DEVSERVICEcxx . . $ `src/cups/backend_hiti.c:930:9`! 0x04
931 #define STATUS2_OPERATORcxx . . $ `src/cups/backend_hiti.c:931:9`! 0x08
932
933 static const char *hiti_statuscxx . . $ hiti_status(366f986dcc4a6ef).(const uint8_tcxx . . $ uint8_t# *sts)
934 {
935 if (sts[2] & STATUS2_WARNINGcxx . . $ `src/cups/backend_hiti.c:929:9`!)
936 return "Warning";
937 else if (sts[2] & STATUS2_DEVSERVICEcxx . . $ `src/cups/backend_hiti.c:930:9`!)
938 return "Service Required";
939 else if (sts[2] & STATUS2_OPERATORcxx . . $ `src/cups/backend_hiti.c:931:9`!)
940 return "Operator Intervention Required";
941 else if (sts[1] & STATUS1_PAPERJAMcxx . . $ `src/cups/backend_hiti.c:927:9`!)
942 return "Paper Jam";
943 else if (sts[1] & STATUS1_INPUTcxx . . $ `src/cups/backend_hiti.c:928:9`!)
944 return "Input Alert";
945 else if (sts[1] & STATUS1_SUPPLIEScxx . . $ `src/cups/backend_hiti.c:926:9`!)
946 return "Supply Alert";
947 else if (sts[0] & STATUS0_RESEND_DATAcxx . . $ `src/cups/backend_hiti.c:924:9`!)
948 return "Resend Data";
949 else if (sts[0] & STATUS0_BUSYcxx . . $ `src/cups/backend_hiti.c:925:9`!)
950 return "Busy";
951 else if (sts[0] & STATUS0_POWERONcxx . . $ `src/cups/backend_hiti.c:923:9`!)
952 return "Powering On";
953 else if (sts[0] == STATUS_IDLEcxx . . $ `src/cups/backend_hiti.c:922:9`!)
954 return "Accepting Jobs";
955 else
956 return "Unknown";
957 }
958
959 static const char *hiti_jobstatusescxx . . $ hiti_jobstatuses(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# code)
960 {
961 switch (code) {
962 case QQA_STATUS_PRINTINGcxx . . $ `src/cups/backend_hiti.c:261:9`!: return "Printing";
963 case QQA_STATUS_WAITINGcxx . . $ `src/cups/backend_hiti.c:262:9`!: return "Waiting";
964 case QQA_STATUS_SUSPENDEDcxx . . $ `src/cups/backend_hiti.c:263:9`!: return "Suspended";
965 case QQA_STATUS_ERRORcxx . . $ `src/cups/backend_hiti.c:264:9`!: return "Unknown Error";
966 default: return "Unknown";
967 }
968 }
969
970 static const char* hiti_ribbontypescxx . . $ hiti_ribbontypes(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# code)
971 {
972 switch (code) {
973 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return "4x6";
974 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return "5x7";
975 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return "6x9";
976 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return "6x8";
977 default: return "Unknown";
978 }
979 }
980
981 static unsigned int hiti_ribboncountscxx . . $ hiti_ribboncounts(ce7b340bf7a3914f).(uint8_tcxx . . $ uint8_t# code, uint8_tcxx . . $ uint8_t# type)
982 {
983 if (type == P_HITI_461cxx . . $ P_HITI_461. ||
984 type == P_HITI_320cxx . . $ P_HITI_320. ||
985 type == P_HITI_310cxx . . $ P_HITI_310.) {
986 switch(code) {
987 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 60;
988 default: return 999;
989 }
990 } else if (type == P_HITI_51Xcxx . . $ P_HITI_51X.) {
991 switch(code) {
992 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 330;
993 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 190;
994 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 165;
995 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return 150;
996 default: return 999;
997 }
998 } else if (type == P_HITI_520cxx . . $ P_HITI_520. || type == P_HITI_525cxx . . $ P_HITI_525. || type == P_HITI_530cxx . . $ P_HITI_530.) {
999 switch(code) {
1000 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 500;
1001 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 290;
1002 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 250;
1003 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return 220; // XXX guess
1004 default: return 999;
1005 }
1006 } else if (type == P_HITI_630cxx . . $ P_HITI_630.) {
1007 switch(code) {
1008 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 430;
1009 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 215;
1010 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 215;
1011 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return 190; // XXX guess
1012 default: return 999;
1013 }
1014 } else if (type == P_HITI_826cxx . . $ P_HITI_826.) {
1015 switch(code) {
1016 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 400;
1017 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 290;
1018 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 200;
1019 default: return 999;
1020 }
1021 } else if (type == P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10.) {
1022 switch(code) {
1023 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 500;
1024 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 290;
1025 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 250; // 200 on brochure, 250 in service manual
1026 default: return 999;
1027 }
1028 } else if (type == P_HITI_720cxx . . $ P_HITI_720.) {
1029 switch(code) {
1030 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 1000;
1031 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 600;
1032 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 455;
1033 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return 455;
1034 default: return 999;
1035 }
1036 } else if (type == P_HITI_750cxx . . $ P_HITI_750.) {
1037 switch(code) {
1038 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!: return 1000;
1039 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!: return 600;
1040 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!: return 500;
1041 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!: return 455;
1042 default: return 999;
1043 }
1044 }
1045
1046 return 999;
1047 }
1048
1049 static const char* hiti_paperscxx . . $ hiti_papers(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# code)
1050 {
1051 switch (code) {
1052 case PAPER_TYPE_NONEcxx . . $ `src/cups/backend_hiti.c:578:9`! : return "None";
1053 case PAPER_TYPE_5INCHcxx . . $ `src/cups/backend_hiti.c:576:9`!: return "5 inch";
1054 case PAPER_TYPE_6INCHcxx . . $ `src/cups/backend_hiti.c:577:9`!: return "6 inch";
1055 case PAPER_TYPE_X4INCHcxx . . $ `src/cups/backend_hiti.c:575:9`!: return "4x6 sheet";
1056 default: return "Unknown";
1057 }
1058 }
1059
1060 static const char* hiti_regionscxx . . $ hiti_regions(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# code)
1061 {
1062 switch (code) {
1063 case 0x11: return "GB";
1064 case 0x12:
1065 case 0x22: return "CN";
1066 case 0x13: return "NA";
1067 case 0x14: return "SA";
1068 case 0x15: return "EU";
1069 case 0x16: return "IN";
1070 case 0x17: return "DB";
1071 case 0xf0: // Seen on P510S
1072 case 0x01: // Seen on P520L, P525L, U826, KSF-10R, P630
1073 default:
1074 return "Unknown";
1075 }
1076 }
1077
1078 /* Supposedly correct for P720, P728, and P520 */
1079 static const char *hiti_errorscxx . . $ hiti_errors(81a3ae90da26a711).(uint32_tcxx . . $ uint32_t# code)
1080 {
1081 switch(code) {
1082 case 0x00000000: return "None";
1083
1084 #if 0
1085 /* Not sure about these, might be driver-generated? */
1086 case 0x00000001: return "Processing data";
1087 case 0x00000002: return "Sending data";
1088 case 0x00000003: return "Printing";
1089 case 0x00000004: return "End page";
1090 case 0x00000005: return "??";
1091 case 0x00000006: return "Starting job";
1092 case 0x00000008: return "Tray missing";
1093
1094 case 0x000000A1: return "Sending Y";
1095 case 0x000000A2: return "Sending M";
1096 case 0x000000A3: return "Sending C";
1097 case 0x000000A4: return "Sending O";
1098 #endif
1099 /* Warning Alerts */
1100 case 0x000100FE: return "Paper type mismatch";
1101 case 0x000300FE: return "Buffer underrun when printing";
1102 case 0x000301FE: return "Command sequence error";
1103 case 0x000302FE: return "NAND flash unformatted";
1104 case 0x000303FE: return "NAND flash space insufficient";
1105 case 0x000304FE: return "Heating parameter table incompatible";
1106 /* Device Service Required Alerts */
1107 case 0x00030001: return "SRAM error";
1108 case 0x00030101: return "SDRAM error";
1109 case 0x00030201: return "ADC error";
1110 case 0x00030301: return "NVRAM R/W error";
1111 case 0x00030302: return "SDRAM checksum error";
1112 case 0x00030402: return "DSP code checksum error";
1113 case 0x00030501: return "Cam TPH error";
1114 case 0x00030502: return "NVRAM checksom error";
1115 case 0x00030601: return "Cam pinch error";
1116 case 0x00030602: return "SRAM checksum error";
1117 case 0x00030701: return "Firmware write error";
1118 case 0x00030702: return "Flash checksum error";
1119 case 0x00030802: return "Heating table checksum error";
1120 case 0x00030901: return "ADC error in slave printer";
1121 case 0x00030A01: return "Cam Platen error in slave printer";
1122 case 0x00030B01: return "NVRAM R/W error in slave printer";
1123 case 0x00030C02: return "NVRAM CRC error in slave printer";
1124 case 0x00030D02: return "SDRAM checksum error in slave printer";
1125 case 0x00030E02: return "SRAM checksum error in slave printer";
1126 case 0x00030F02: return "FLASH checksum error in slave printer";
1127 case 0x00031002: return "Wrong firmware checksum error in slave printer";
1128 case 0x00031101: return "Communication error with slave printer";
1129 case 0x00031201: return "NAND flash error";
1130 case 0x00031302: return "Cutter error";
1131 /* Operator Intervention Required Alerts */
1132 case 0x00050001: return "Cover open"; // XXX or no ribbon loaded on P461?
1133 case 0x00050101: return "Cover open";
1134 case 0x000502FE: return "Dust box needs cleaning";
1135 /* Supplies Alerts */
1136 case 0x00080004: return "Ribbon missing";
1137 case 0x00080007: return "Ribbon newly inserted";
1138 case 0x00080103: return "Ribbon exhausted";
1139 case 0x00080104: return "Ribbon exhausted";
1140 case 0x00080105: return "Ribbon malfunction";
1141 case 0x00080204: return "Ribbon missing in slave printer";
1142 case 0x00080207: return "Ribbon newly inserted in slave printer";
1143 case 0x000802FE: return "Ribbon IC error";
1144 case 0x00080303: return "Ribbon exhausted in slave printer";
1145 case 0x000803FE: return "Ribbon not authenticated";
1146 case 0x000804FE: return "Ribbon IC read/write error";
1147 case 0x000805FE: return "Ribbon IC read/write error in slave printer";
1148 case 0x000806FE: return "Unsupported ribbon";
1149 case 0x000807FE: return "Unsupported ribbon in slave printer";
1150 case 0x000808FE: return "Unknown ribbon";
1151 case 0x000809FE: return "Unknown ribbon in slave printer";
1152 /* Jam Alerts */
1153 case 0x00030000: return "Paper jam";
1154 case 0x0003000F: return "Paper jam";
1155 case 0x00030200: return "Paper jam in paper path 01";
1156 case 0x00030300: return "Paper jam in paper path 02";
1157 case 0x00030400: return "Paper jam in paper path 03";
1158 case 0x00030500: return "Paper jam in paper path 04";
1159 case 0x00030600: return "Paper jam in paper path 05";
1160 case 0x00030700: return "Paper jam in paper path 06";
1161 case 0x00030800: return "Paper jam in paper path 07";
1162 case 0x00030900: return "Paper jam in paper path 08";
1163 case 0x00030A00: return "Paper jam in paper path 09";
1164 /* Input Alerts */
1165 case 0x00000008: return "Paper box missing";
1166 case 0x00000100: return "Cover open";
1167 case 0x00000101: return "Cover open failure";
1168 case 0x00000200: return "Ribbon IC missing";
1169 case 0x00000201: return "Ribbon missing";
1170 case 0x00000202: return "Ribbon mismatch 01";
1171 case 0x00000203: return "Security check fail";
1172 case 0x00000204: return "Ribbon mismatch 02";
1173 case 0x00000205: return "Ribbon mismatch 03";
1174 case 0x00000300: return "Ribbon exhausted 01";
1175 case 0x00000301: return "Ribbon exhausted 02";
1176 case 0x00000302: return "Printing failure (jam?)";
1177 case 0x00000400: return "Paper exhausted 01";
1178 case 0x00000401: return "Paper exhausted 02";
1179 case 0x00000402: return "Paper not ready";
1180 case 0x00000500: return "Paper jam 01";
1181 case 0x00000501: return "Paper jam 02";
1182 case 0x00000502: return "Paper jam 03";
1183 case 0x00000503: return "Paper jam 04";
1184 case 0x00000504: return "Paper jam 05";
1185 case 0x00000600: return "Paper mismatch";
1186 case 0x00000700: return "Cam error 01";
1187 case 0x00000800: return "Cam error 02";
1188 case 0x00000900: return "NVRAM error";
1189 case 0x00001000: return "IC error";
1190 case 0x00001200: return "ADC error";
1191 case 0x00001300: return "FW Check Error";
1192 case 0x00001500: return "Cutter error";
1193
1194 case 0x00007538: return "Device attached to printer";
1195 case 0x00007539: return "Printer is in mobile mode";
1196 case 0x00007540: return "Printer is in standalone mode";
1197 case 0x00007542: return "Firmware too old for Fine mode";
1198 case 0x00007543: return "Firmware too old for 2x6 mode";
1199 case 0x00007544: return "Firmware too old for Matte mode";
1200 case 0x00007545: return "Firmware too old";
1201 case 0x00007546: return "Firmware too old";
1202
1203 case 0x00008000: return "Paper out or feeding error";
1204 case 0x00008008: return "Paper box missing";
1205 case 0x00008010: return "Paper tray/roll mismatch";
1206 case 0x00008011: return "Paper tray mismatch (need photo tray)";
1207 case 0x00008012: return "Paper tray mismatch (need sticker 4/2/4 tray)";
1208 case 0x00008013: return "Paper tray mismatch (need sticker 4x4 tray)";
1209 case 0x00008014: return "Paper tray mismatch (need sticker 1x1 tray)";
1210 case 0x00008015: return "Paper tray mismatch (need PVC tray)";
1211 case 0x00080200: return "Unsupported ribbon type";
1212 case 0x00080201: return "Ribbon type mismatch (need YMCO)";
1213 case 0x00080203: return "Ribbon type mismatch (need KO)";
1214 case 0x00080230: return "Ribbon type mismatch (need KO)";
1215 case 0x00080240: return "Ribbon type mismatch (need 4x6)";
1216 case 0x00080250: return "Ribbon type mismatch (need 5x7)";
1217 case 0x00080260: return "Ribbon type mismatch (need 6x8)";
1218 // case 0x10008000: return "Paper out or paper low"; /* XXX this won't work, high byte is cleared */
1219
1220 default: return "Unknown";
1221 }
1222 }
1223
1224 static int hiti_dump_optionscxx . . $ hiti_dump_options(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
1225 {
1226 int ret;
1227 uint8_tcxx . . $ uint8_t# buf[256];
1228 uint16_tcxx . . $ uint16_t# len = 256;
1229 int i;
1230 uint8_tcxx . . $ uint8_t# *ptr;
1231
1232 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDC_ROCcxx . . $ `src/cups/backend_hiti.c:76:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0,
1233 buf, &len);
1234 if (ret)
1235 return ret;
1236
1237 ptr = buf;
1238 while (len > 0 && *ptr) {
1239 i = ptr[ptr[1]+2];
1240 ptr[ptr[1]+2] = 0;
1241 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Option %02x: '%s'\n", *ptr, ptr+2);
1242 len -= ptr[1] + 2;
1243 ptr += ptr[1] + 2;
1244 *ptr = i;
1245 }
1246
1247
1248 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
1249 }
1250
1251 static int hiti_get_infocxx . . $ hiti_get_info(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
1252 {
1253 int ret;
1254
1255 ret = hiti_query_tphvcxx . . $ hiti_query_tphv(47d69a6bfedd2223).(ctx);
1256 if (ret)
1257 return ret;
1258 ret = hiti_query_led_calibrationcxx . . $ hiti_query_led_calibration(47d69a6bfedd2223).(ctx);
1259 if (ret)
1260 return ret;
1261
1262 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer ID: %s\n", ctx->id);
1263 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer Version: %s\n", ctx->version);
1264 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Serial Number: %s\n", ctx->serno);
1265
1266 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_51Xcxx . . $ P_HITI_51X.) {
1267 ret = hiti_dump_optionscxx . . $ hiti_dump_options(47d69a6bfedd2223).(ctx);
1268 if (ret)
1269 return ret;
1270 }
1271
1272 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Calibration: H: %d V: %d\n", ctx->calibration.rows, ctx->calibration.cols);
1273 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("LED Calibration: %d %d %d / %d %d %d\n",
1274 ctx->led_calibration[4], ctx->led_calibration[5],
1275 ctx->led_calibration[6], ctx->led_calibration[7],
1276 ctx->led_calibration[8], ctx->led_calibration[9]);
1277 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("TPH Voltage (T/L): %d %d\n", ctx->rtlv[0], ctx->rtlv[1]);
1278 hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1279
1280 if (!(ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_520cxx . . $ P_HITI_520. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_525cxx . . $ P_HITI_525. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_826cxx . . $ P_HITI_826. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_630cxx . . $ P_HITI_630.)) {
1281 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Region: %s (%02x)\n",
1282 hiti_regions(ctx->rpidm.region),
1283 ctx->rpidm.region);
1284 }
1285
1286 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_51Xcxx . . $ P_HITI_51X.) {
1287 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Highlight Adjustment (Y M C): %d %d %d\n",
1288 ctx->hilight_adj[1], ctx->hilight_adj[2], ctx->hilight_adj[3]);
1289 }
1290
1291 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Status Summary: %d %dx%d %dx%d\n",
1292 ctx->erdc_rs.stride,
1293 ctx->erdc_rs.cols,
1294 ctx->erdc_rs.rows,
1295 ctx->erdc_rs.dpi_cols,
1296 ctx->erdc_rs.dpi_rows);
1297
1298 uint32_tcxx . . $ uint32_t# buf[2] = {0,0};
1299 ret = hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 1, buf, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.);
1300 if (ret)
1301 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1302 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Total prints: %u\n", buf[0]);
1303
1304 ret = hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 2, buf, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.);
1305 if (ret)
1306 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1307 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("6x4 prints: %u\n", buf[0]);
1308
1309 if (!ctx->sheetcxx . . $ hiti_ctx#sheet.) {
1310 ret = hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 3, buf, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.);
1311 if (ret)
1312 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1313 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("5x7 prints: %u\n", buf[0]);
1314
1315 ret = hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 4, buf, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.);
1316 if (ret)
1317 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1318 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("6x8 prints: %u\n", buf[0]);
1319
1320 ret = hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 5, buf, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.);
1321 if (ret)
1322 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1323 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("6x9 prints: %u\n", buf[0]);
1324 }
1325
1326 // XXX other shit..
1327
1328 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
1329 }
1330
1331 /* Use jobid of 0 for "any" */
1332 static int hiti_query_job_qacxx . . $ hiti_query_job_qa(962c75e45e54edc0).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, struct hiti_jobcxx . . $ hiti_job# *jobid, struct hiti_job_qqacxx . . $ hiti_job_qqa# *resp)
1333 {
1334 int ret;
1335 uint16_tcxx . . $ uint16_t# len = sizeof(*resp);
1336
1337 resp->countcxx . . $ hiti_job_qqa#count. = 0;
1338 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_JC_QQAcxx . . $ `src/cups/backend_hiti.c:99:9`!,
1339 (uint8_tcxx . . $ uint8_t#*) jobid, sizeof(*jobid),
1340 (uint8_tcxx . . $ uint8_t#*) resp, &len);
1341 if (ret)
1342 return ret;
1343
1344 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
1345 }
1346
1347 static int hiti_get_statuscxx . . $ hiti_get_status(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
1348 {
1349 uint8_tcxx . . $ uint8_t# sts[3];
1350 uint32_tcxx . . $ uint32_t# err = 0;
1351 int ret, i;
1352 struct hiti_job_qqacxx . . $ hiti_job_qqa# qqa;
1353
1354 hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1355 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
1356 if (ret)
1357 return ret;
1358
1359 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer ID: %s\n", ctx->id);
1360 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer Version: %s\n", ctx->version);
1361 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Serial Number: %s\n", ctx->serno);
1362
1363 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer Status: %s (%02x %02x %02x)\n",
1364 hiti_status(sts), sts[0], sts[1], sts[2]);
1365 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer Error: %s (%08x)\n",
1366 hiti_errors(err), err);
1367
1368 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Media: %s (%02x / %04x) : %03u/%03u\n",
1369 hiti_ribbontypes(ctx->ribbon.type),
1370 ctx->ribbon.type,
1371 ctx->ribbonvendor,
1372 ctx->media_remain, hiti_ribboncounts(ctx->ribbon.type, ctx->conn->type));
1373 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Paper: %s (%02x)\n",
1374 hiti_papers(ctx->paper.type),
1375 ctx->paper.type);
1376
1377 /* Find out if we have any jobs outstanding */
1378 struct hiti_jobcxx . . $ hiti_job# job = { 0 };
1379 hiti_query_job_qacxx . . $ hiti_query_job_qa(962c75e45e54edc0).(ctx, &job, &qqa);
1380 for (i = 0 ; i < qqa.countcxx . . $ hiti_job_qqa#count. ; i++) {
1381 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("JobID %02x %04x (status %s)\n",
1382 qqa.row[i].job.lun,
1383 be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(qqa.row[i].job.jobid),
1384 hiti_jobstatuses(qqa.row[i].status));
1385 }
1386
1387 // XXX other shit...?
1388
1389 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
1390 }
1391
1392 static void *hiti_initcxx . . $ hiti_init(50c7df7de5344ebb).(void)
1393 {
1394 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct hiti_ctxcxx . . $ hiti_ctx#));
1395 if (!ctx) {
1396 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory Allocation Failure!\n");
1397 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1398 }
1399 memsetcxx . . $ memset(d1de1e4fb215f1c6).(ctx, 0, sizeof(struct hiti_ctxcxx . . $ hiti_ctx#));
1400
1401 if (getenvcxx . . $ getenv(a8b8e32347182212).("HITI_NODATA")) {
1402 ctx->nodatacxx . . $ hiti_ctx#nodata. = 1;
1403 }
1404 return ctx;
1405 }
1406
1407 static int hiti_attachcxx . . $ hiti_attach(65a6cf861cd15f84).(void *vctx, struct dyesub_connectioncxx . . $ dyesub_connection# *conn, uint8_tcxx . . $ uint8_t# jobid)
1408 {
1409 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
1410 int ret;
1411
1412 ctx->conncxx . . $ hiti_ctx#conn. = conn;
1413
1414 /* Ensure jobid is sane */
1415 ctx->jobidcxx . . $ hiti_ctx#jobid. = (jobid & 0x7fff);
1416 if (!ctx->jobidcxx . . $ hiti_ctx#jobid.)
1417 ctx->jobidcxx . . $ hiti_ctx#jobid.++;
1418
1419 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_51Xcxx . . $ P_HITI_51X.) {
1420 ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len. = 2;
1421 } else {
1422 ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len. = 1;
1423 }
1424
1425 /* Sheet type */
1426 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_461cxx . . $ P_HITI_461. ||
1427 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_320cxx . . $ P_HITI_320. ||
1428 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_310cxx . . $ P_HITI_310.) {
1429 ctx->sheetcxx . . $ hiti_ctx#sheet. = 1;
1430 }
1431
1432 switch(ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type.) {
1433 case P_HITI_461cxx . . $ P_HITI_461.:
1434 case P_HITI_320cxx . . $ P_HITI_320.:
1435 case P_HITI_310cxx . . $ P_HITI_310.:
1436 ctx->heattable_typecxx . . $ hiti_ctx#heattable_type. = HEATTABLE_TYPE_V0cxx . . $ HEATTABLE_TYPE_V0.;
1437 break;
1438 case P_HITI_51Xcxx . . $ P_HITI_51X.:
1439 ctx->heattable_typecxx . . $ hiti_ctx#heattable_type. = HEATTABLE_TYPE_V1cxx . . $ HEATTABLE_TYPE_V1.;
1440 break;
1441 default:
1442 ctx->heattable_typecxx . . $ hiti_ctx#heattable_type. = HEATTABLE_TYPE_V2cxx . . $ HEATTABLE_TYPE_V2.;
1443 }
1444
1445 if (test_modecxx . . $ test_mode. < TEST_MODE_NOATTACHcxx . . $ TEST_MODE_NOATTACH.) {
1446 /* P520 firmware v1.19-v1.21 lose their minds when Linux
1447 issues a routine CLEAR_ENDPOINT_HALT. Printer can recover
1448 if it is reset. Unclear what the side effects are.. */
1449 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_520cxx . . $ P_HITI_520.)
1450 libusb_reset_devicecxx . . $ libusb_reset_device(dd77b85f23bd2c47).(ctx->conncxx . . $ hiti_ctx#conn.->devcxx . . $ dyesub_connection#dev.);
1451
1452 if (!ctx->sheetcxx . . $ hiti_ctx#sheet.) {
1453 ret = hiti_query_unk8010cxx . . $ hiti_query_unk8010(47d69a6bfedd2223).(ctx);
1454 if (ret)
1455 return ret;
1456 }
1457 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_51Xcxx . . $ P_HITI_51X.) {
1458 ret = hiti_query_unk800ccxx . . $ hiti_query_unk800c(47d69a6bfedd2223).(ctx);
1459 if (ret)
1460 return ret;
1461 }
1462 ret = hiti_query_versioncxx . . $ hiti_query_version(47d69a6bfedd2223).(ctx);
1463 if (ret)
1464 return ret;
1465 ret = hiti_query_suppliescxx . . $ hiti_query_supplies(47d69a6bfedd2223).(ctx);
1466 if (ret)
1467 return ret;
1468 ret = hiti_query_calibrationcxx . . $ hiti_query_calibration(47d69a6bfedd2223).(ctx);
1469 if (ret)
1470 return ret;
1471 if (ctx->sheetcxx . . $ hiti_ctx#sheet.) {
1472 ctx->papercxx . . $ hiti_ctx#paper..typecxx . . $ hiti_paper#type. = PAPER_TYPE_X4INCHcxx . . $ `src/cups/backend_hiti.c:575:9`!;
1473 ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor. = 0x1000; /* Hardcoded */
1474 } else {
1475 ret = hiti_query_ribbonvendorcxx . . $ hiti_query_ribbonvendor(47d69a6bfedd2223).(ctx);
1476 if (ret)
1477 return ret;
1478 }
1479 ret = hiti_query_rpidmcxx . . $ hiti_query_rpidm(47d69a6bfedd2223).(ctx);
1480 if (ret)
1481 return ret;
1482
1483 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_51Xcxx . . $ P_HITI_51X. && !ctx->sheetcxx . . $ hiti_ctx#sheet.) {
1484 ret = hiti_query_hilightadjcxx . . $ hiti_query_hilightadj(47d69a6bfedd2223).(ctx);
1485 if (ret)
1486 return ret;
1487 }
1488
1489 ret = hiti_query_sernocxx . . $ hiti_query_serno(a3ebabf18f8093e8).(ctx->conncxx . . $ hiti_ctx#conn., ctx->sernocxx . . $ hiti_ctx#serno., sizeof(ctx->sernocxx . . $ hiti_ctx#serno.));
1490 if (ret)
1491 return ret;
1492
1493 ret = hiti_query_summarycxx . . $ hiti_query_summary(dae0eb98bf879044).(ctx, &ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs.);
1494 if (ret)
1495 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1496
1497 switch (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type.) {
1498 case P_HITI_310cxx . . $ P_HITI_310.:
1499 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.17.0", 6) < 0)
1500 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.17.0");
1501 break;
1502 case P_HITI_320cxx . . $ P_HITI_320.:
1503 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.04.0", 6) < 0)
1504 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.04.0");
1505 break;
1506 case P_HITI_461cxx . . $ P_HITI_461.:
1507 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.12.0", 6) < 0)
1508 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.12.0");
1509 break;
1510 // XXX P510s: v2.05.0 is latest known so far...
1511 case P_HITI_520cxx . . $ P_HITI_520.:
1512 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.22", 4) < 0 &&
1513 strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.17", 4) > 0) /* V1.18 -> v1.21 have a known USB CLEAR_ENDPOINT_HALT issue */
1514 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s has a known USB bug, please update to at least v1.22\n", ctx->version);
1515 else if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.30", 4) < 0)
1516 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.30");
1517 break;
1518 case P_HITI_525cxx . . $ P_HITI_525.:
1519 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.05", 4) < 0)
1520 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.05");
1521 break;
1522 case P_HITI_530cxx . . $ P_HITI_530.:
1523 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.02.0", 6) < 0)
1524 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.02.0");
1525 break;
1526 case P_HITI_630cxx . . $ P_HITI_630.:
1527 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "9.05.2", 6) < 0)
1528 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v9.05.2.3");
1529 break;
1530 case P_HITI_720cxx . . $ P_HITI_720.:
1531 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.19", 4) < 0)
1532 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.19");
1533 break;
1534 case P_HITI_750cxx . . $ P_HITI_750.:
1535 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.22.0", 6) < 0)
1536 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.22.0");
1537 break;
1538 case P_HITI_826cxx . . $ P_HITI_826.:
1539 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.07.0", 6) < 0)
1540 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.07.0");
1541 break;
1542 case P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10.:
1543 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ctx->versioncxx . . $ hiti_ctx#version., "1.00.0", 6) < 0)
1544 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer firmware %s out of date (vs %s), please update.\n", ctx->version, "v1.00.0");
1545 break;
1546 default:
1547 break;
1548 }
1549 // do real stuff
1550 } else {
1551 if (ctx->sheetcxx . . $ hiti_ctx#sheet.) {
1552 ctx->papercxx . . $ hiti_ctx#paper..typecxx . . $ hiti_paper#type. = PAPER_TYPE_X4INCHcxx . . $ `src/cups/backend_hiti.c:575:9`!;
1553 ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. = 1280;
1554 } else {
1555 ctx->papercxx . . $ hiti_ctx#paper..typecxx . . $ hiti_paper#type. = PAPER_TYPE_6INCHcxx . . $ `src/cups/backend_hiti.c:577:9`!;
1556 ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. = 1844;
1557 }
1558
1559 ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type. = RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!;
1560 ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor. = 0x101f; /* CHC, type 0x1f */
1561 if (getenvcxx . . $ getenv(a8b8e32347182212).("MEDIA_CODE") && strlencxx . . $ strlen(751346f8406fd082).(getenvcxx . . $ getenv(a8b8e32347182212).("MEDIA_CODE"))) {
1562 // set fake fw version?
1563 ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type. = strtolcxx . . $ strtol(44bbb87609b212fc).(getenvcxx . . $ getenv(a8b8e32347182212).("MEDIA_CODE"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 16);
1564 if (ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type. == RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!)
1565 ctx->papercxx . . $ hiti_ctx#paper..typecxx . . $ hiti_paper#type. = PAPER_TYPE_5INCHcxx . . $ `src/cups/backend_hiti.c:576:9`!;
1566 }
1567 }
1568
1569 ctx->markercxx . . $ hiti_ctx#marker..colorcxx . . $ marker#color. = "#00FFFF#FF00FF#FFFF00";
1570 ctx->markercxx . . $ hiti_ctx#marker..namecxx . . $ marker#name. = hiti_ribbontypescxx . . $ hiti_ribbontypes(42624c5f3be67010).(ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type.);
1571 ctx->markercxx . . $ hiti_ctx#marker..levelmaxcxx . . $ marker#levelmax. = hiti_ribboncountscxx . . $ hiti_ribboncounts(ce7b340bf7a3914f).(ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type., ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type.);
1572 ctx->markercxx . . $ hiti_ctx#marker..levelnowcxx . . $ marker#levelnow. = 0;
1573
1574 if (ctx->sheetcxx . . $ hiti_ctx#sheet.)
1575 ctx->markercxx . . $ hiti_ctx#marker..numtypecxx . . $ marker#numtype. = -1;
1576 else
1577 ctx->markercxx . . $ hiti_ctx#marker..numtypecxx . . $ marker#numtype. = ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type.;
1578
1579 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
1580 }
1581
1582 static void hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(const void *vjob) {
1583 const struct hiti_printjobcxx . . $ hiti_printjob# *job = vjob;
1584
1585 if (job->databufcxx . . $ hiti_printjob#databuf.)
1586 freecxx . . $ free(5d22bdacc48458e8).(job->databufcxx . . $ hiti_printjob#databuf.);
1587
1588 if (job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.)
1589 freecxx . . $ free(5d22bdacc48458e8).(job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.);
1590 if (job->heattable_bufcxx . . $ hiti_printjob#heattable_buf.)
1591 freecxx . . $ free(5d22bdacc48458e8).(job->heattable_bufcxx . . $ hiti_printjob#heattable_buf.);
1592 // job->num_heattable_entries = 0;
1593
1594 freecxx . . $ free(5d22bdacc48458e8).((void*)job);
1595 }
1596
1597 static void *hiti_get_heat_datacxx . . $ hiti_get_heat_data(28d1560eef524a37).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# mode, uint8_tcxx . . $ uint8_t# colormode, int ribbonvendor, int *len)
1598 {
1599 int ret;
1600 void *buf;
1601
1602 int mediaver = ribbonvendor & RRVC_VERSION_MASKcxx . . $ `src/cups/backend_hiti.c:668:9`!;
1603 int mediatype = ribbonvendor & RRVC_VENDOR_MASKcxx . . $ `src/cups/backend_hiti.c:667:9`!;
1604
1605 const char *modelname = hiti_modelcodecxx . . $ hiti_modelcode(bd5db3388d838e27).(ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type., ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..hwFeature1cxx . . $ hiti_erdc_rs#hwFeature1. & 0x80); // XXX P52x only
1606 const char *modename;
1607 const char *medianame;
1608 char fname_base[24];
1609
1610 buf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(HEATTABLE_V2_MAX_SIZEcxx . . $ `src/cups/backend_hiti.c:336:9`!);
1611 if (!buf) {
1612 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Memory allocation failure!\n");
1613 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1614 }
1615
1616 switch (colormode) {
1617 case HT_COLORMODE_METALLICcxx . . $ HT_COLORMODE_METALLIC.:
1618 modename = "m";
1619 mode = 0;
1620 break;
1621 case HT_COLORMODE_HIGHDENSITYcxx . . $ HT_COLORMODE_HIGHDENSITY.:
1622 modename = "h";
1623 mode = 0;
1624 break;
1625 case HT_COLORMODE_TRANSPARENTcxx . . $ HT_COLORMODE_TRANSPARENT.:
1626 modename = "r";
1627 mode = 0;
1628 break;
1629 default:
1630 if (mode) {
1631 modename = "q";
1632 } else {
1633 modename = "t";
1634 } // XXX p/o/s ??
1635 break;
1636 }
1637
1638 if (mediatype == 0x1000) {
1639 medianame = "c";
1640 } else {
1641 medianame = "h";
1642 } // XXX 'd' ??
1643
1644 // XXX special case! hea0qcra.bin/heatqcra.bin, and hea0tcra.bin/heattcra.bin, and they differ!
1645
1646 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Locating heat table for model %d, mode %02x/%02x media %02x, ver %02x\n",
1647 ctx->conn->type, mode, colormode, mediatype >> 8, mediaver);
1648
1649 while (mediaver >= 0) {
1650 char full[2048];
1651
1652 char ver;
1653
1654 if (mediaver == 0)
1655 ver = 't';
1656 else if (mediaver < 10)
1657 ver = '0' + mediaver;
1658 else
1659 ver = 'a' + mediaver - 10;
1660
1661 /* Build base name */
1662 snprintfcxx . . $ snprintf(ea502d73e74c754c).(fname_base, sizeof(fname_base)-1, "hea%c%s%s%s.bin", ver, modename, medianame, modelname);
1663
1664 snprintfcxx . . $ snprintf(ea502d73e74c754c).(full, sizeof(full), "%s/%s", corrtable_pathcxx . . $ corrtable_path., fname_base);
1665
1666 ret = dyesub_read_file2cxx . . $ dyesub_read_file2(915904cff5e9dc66).(full, buf, HEATTABLE_V2_MAX_SIZEcxx . . $ `src/cups/backend_hiti.c:336:9`!, len, 1);
1667 if (!ret)
1668 break;
1669
1670 mediaver--;
1671 }
1672
1673 if (mediaver < 0) {
1674 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Unable to find suitable heat table file (%s) skipping\n", fname_base);
1675 freecxx . . $ free(5d22bdacc48458e8).(buf);
1676 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1677 }
1678
1679 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Using heat table in (%s)\n", fname_base);
1680
1681 return buf;
1682 }
1683
1684 #define CORRECTION_FILE_SIZEcxx . . $ `src/cups/backend_hiti.c:1684:9`! (33*33*33*3 + 2)
1685 static uint8_tcxx . . $ uint8_t# *hiti_get_correction_datacxx . . $ hiti_get_correction_data(31c88ba2c60ae85b).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# mode, int colormode, int ribbonvendor)
1686 {
1687 uint8_tcxx . . $ uint8_t# *buf;
1688 int ret, len;
1689
1690 int mediaver = ribbonvendor & RRVC_VERSION_MASKcxx . . $ `src/cups/backend_hiti.c:668:9`!;
1691 int mediatype = ribbonvendor & RRVC_VENDOR_MASKcxx . . $ `src/cups/backend_hiti.c:667:9`!;
1692
1693 const char *modelname = hiti_modelcodecxx . . $ hiti_modelcode(bd5db3388d838e27).(ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type., ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..hwFeature1cxx . . $ hiti_erdc_rs#hwFeature1. & 0x80);
1694 const char *colorname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1695 const char *modename;
1696 const char *medianame;
1697 char fname_base[24] = {0};
1698
1699 buf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(CORRECTION_FILE_SIZEcxx . . $ `src/cups/backend_hiti.c:1684:9`!);
1700 if (!buf) {
1701 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Memory allocation failure!\n");
1702 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1703 }
1704
1705 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_CS2XXcxx . . $ P_HITI_CS2XX.) {
1706 colorname = "B"; // XXX many more, investigate more carefully.
1707 } else if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_520cxx . . $ P_HITI_520. ||
1708 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_525cxx . . $ P_HITI_525. ||
1709 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_826cxx . . $ P_HITI_826. ||
1710 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_630cxx . . $ P_HITI_630. || // XXX eventually?
1711 ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10.) {
1712 if (colormode == HT_COLORMODE_METALLICcxx . . $ HT_COLORMODE_METALLIC.)
1713 colorname = "M";
1714 else if (colormode == HT_COLORMODE_HIGHDENSITYcxx . . $ HT_COLORMODE_HIGHDENSITY.)
1715 colorname = "H";
1716 else if (colormode == HT_COLORMODE_TRANSPARENTcxx . . $ HT_COLORMODE_TRANSPARENT.)
1717 colorname = "T";
1718 }
1719
1720 if (!colorname) {
1721 if (colormode == HT_COLORMODE_CLASSICcxx . . $ HT_COLORMODE_CLASSIC.) {
1722 colorname = "CL";
1723 } else if (colormode == HT_COLORMODE_IDPASS_VIVIDcxx . . $ HT_COLORMODE_IDPASS_VIVID.) {
1724 colorname = "P";
1725 } else {
1726 colorname = "I";
1727 } // XXX PR, L, LR, C, SO, B, and more?
1728 }
1729
1730 if (mode) {
1731 modename = "Q";
1732 } else {
1733 modename = "P";
1734 }
1735
1736 if (mediatype == 0x1000) {
1737 medianame = "C";
1738 } else {
1739 medianame = "M";
1740 } // XXX K/D ??
1741
1742 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Locating correction data for model %d, mode %02x, media %02x, ver %02x, color %02x\n",
1743 ctx->conn->type, mode, mediatype >> 8, mediaver, colormode);
1744
1745 /* Prefer file with explicit '0' version, fall back to one without it. */
1746 while (mediaver >= -1) {
1747 char full[2048];
1748
1749 /* Build base name */
1750 if (mediaver >= 0)
1751 snprintfcxx . . $ snprintf(ea502d73e74c754c).(fname_base, sizeof(fname_base)-1, "C%s%s%s%c%s.bin",
1752 medianame, modename, colorname,
1753 mediaver < 10 ? '0' + mediaver : 'a' + mediaver - 10,
1754 modelname);
1755 else
1756 snprintfcxx . . $ snprintf(ea502d73e74c754c).(fname_base, sizeof(fname_base)-1, "C%s%s%s%s.bin", medianame, modename, colorname, modelname);
1757
1758 snprintfcxx . . $ snprintf(ea502d73e74c754c).(full, sizeof(full), "%s/%s", corrtable_pathcxx . . $ corrtable_path., fname_base);
1759 ret = dyesub_read_file2cxx . . $ dyesub_read_file2(915904cff5e9dc66).(full, buf, CORRECTION_FILE_SIZEcxx . . $ `src/cups/backend_hiti.c:1684:9`!, &len, 1);
1760 if (!ret && len == CORRECTION_FILE_SIZEcxx . . $ `src/cups/backend_hiti.c:1684:9`!) {
1761 break;
1762 }
1763
1764 mediaver--;
1765 }
1766
1767 if (mediaver < -1) {
1768 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Unable to find suitable correction data file (%s) skipping\n", fname_base);
1769 freecxx . . $ free(5d22bdacc48458e8).(buf);
1770 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1771 }
1772
1773 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Using correction data in (%s)\n", fname_base);
1774
1775 return buf;
1776 }
1777
1778 static int hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# plane,
1779 const uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# buf_len)
1780 {
1781 uint8_tcxx . . $ uint8_t# cmdbuf[sizeof(struct hiti_seht2cxx . . $ hiti_seht2#)];
1782 struct hiti_seht2cxx . . $ hiti_seht2# *cmd = (struct hiti_seht2cxx . . $ hiti_seht2# *)cmdbuf;
1783 int ret, num = 0;
1784
1785 buf_len += 5;
1786
1787 cmd->hdrcxx . . $ hiti_seht2#hdr. = 0xa5;
1788 cmd->lencxx . . $ hiti_seht2#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(buf_len >> 8);
1789 cmd->flagcxx . . $ hiti_seht2#flag. = (CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! | CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`!);
1790 cmd->cmdcxx . . $ hiti_seht2#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(CMD_ESD_SEHT2cxx . . $ `src/cups/backend_hiti.c:149:9`!);
1791 cmd->lenbcxx . . $ hiti_seht2#lenb. = buf_len & 0xff;
1792 cmd->planecxx . . $ hiti_seht2#plane. = plane;
1793
1794 buf_len -= 5;
1795
1796 /* Send over command */
1797 if ((ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., (uint8_tcxx . . $ uint8_t#*) cmd, sizeof(*cmd)))) {
1798 return ret;
1799 }
1800
1801 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
1802
1803 /* Read back command */
1804 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., cmdbuf, 6, &num);
1805 if (ret)
1806 return ret;
1807
1808 // XXX check resp length?
1809
1810 /* Send payload, if any */
1811 if (buf_len) {
1812 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., buf, buf_len);
1813 }
1814
1815 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(200*1000);
1816
1817 return ret;
1818 }
1819
1820 static int hiti_cvdcxx . . $ hiti_cvd(b1de4f2fc8046d60).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, const uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# buf_len)
1821 {
1822 uint8_tcxx . . $ uint8_t# cmdbuf[sizeof(struct hiti_cmdcxx . . $ hiti_cmd#)];
1823 struct hiti_cmdcxx . . $ hiti_cmd# *cmd = (struct hiti_cmdcxx . . $ hiti_cmd# *)cmdbuf;
1824 int ret, num = 0;
1825
1826 cmd->hdrcxx . . $ hiti_cmd#hdr. = 0xa5;
1827 cmd->lencxx . . $ hiti_cmd#len. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(buf_len + 3);
1828 cmd->flagcxx . . $ hiti_cmd#flag. = (CMD_FLAG_DESTcxx . . $ `src/cups/backend_hiti.c:58:9`! | CMD_FLAG_REPLYcxx . . $ `src/cups/backend_hiti.c:60:9`!);
1829 cmd->cmdcxx . . $ hiti_cmd#cmd. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(CMD_EDM_CVDcxx . . $ `src/cups/backend_hiti.c:174:9`!);
1830
1831 /* Send over command */
1832 if ((ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., (uint8_tcxx . . $ uint8_t#*) cmd, sizeof(*cmd)))) {
1833 return ret;
1834 }
1835
1836 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(10*1000);
1837
1838 /* Read back command */
1839 ret = read_datacxx . . $ read_data(b488de55810172b7).(ctx->conncxx . . $ hiti_ctx#conn., cmdbuf, 6, &num);
1840 if (ret)
1841 return ret;
1842
1843 // XXX check resp length?
1844
1845 /* Send payload, if any */
1846 if (buf_len) {
1847 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., buf, buf_len);
1848 }
1849
1850 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(200*1000);
1851
1852 return ret;
1853 }
1854
1855 static void *hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(uint8_tcxx . . $ uint8_t# *data, int type, int totallen)
1856 {
1857 int offset = 0;
1858 while (offset < totallen) {
1859 struct hiti_heattable_hdr_v1cxx . . $ hiti_heattable_hdr_v1# *hdr = (struct hiti_heattable_hdr_v1cxx . . $ hiti_heattable_hdr_v1# *) (data + offset);
1860 offset += sizeof(*hdr);
1861
1862 if (hdr->typecxx . . $ hiti_heattable_hdr_v1#type. == type)
1863 return data + offset;
1864 offset += (le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(hdr->len) * 2);
1865 }
1866 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1867 }
1868
1869 static int hiti_send_heat_data_v1cxx . . $ hiti_send_heat_data_v1(70d59b1d0db9a632).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, void *heatdata, int len, uint8_tcxx . . $ uint8_t# matte)
1870 {
1871 uint8_tcxx . . $ uint8_t# *y, *m, *c, *o, *om, *cvd;
1872
1873 int ret;
1874
1875 y = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_Ycxx . . $ `src/cups/backend_hiti.c:313:9`!, len);
1876 m = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_Mcxx . . $ `src/cups/backend_hiti.c:314:9`!, len);
1877 c = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_Ccxx . . $ `src/cups/backend_hiti.c:315:9`!, len);
1878 o = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_Ocxx . . $ `src/cups/backend_hiti.c:317:9`!, len);
1879 om = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_OMcxx . . $ `src/cups/backend_hiti.c:318:9`!, len);
1880 cvd = hiti_heattablev1_find_entrycxx . . $ hiti_heattablev1_find_entry(1189300a8a62d5c8).(heatdata, HITI_HEATTABLE_V1_CVDcxx . . $ `src/cups/backend_hiti.c:319:9`!, len);
1881
1882 if (!y || !m || !c || !o || !om || !cvd) {
1883 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Heattable incomplete\n");
1884 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
1885 }
1886
1887 /* Send over the heat tables */
1888 ret = hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(ctx, 0, y, HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`!);
1889 if (!ret)
1890 ret = hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(ctx, 1, m, HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`!);
1891 if (!ret)
1892 ret = hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(ctx, 2, c, HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`!);
1893 if (!ret) {
1894 if (matte)
1895 ret = hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(ctx, 3, om, HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`!);
1896 else
1897 ret = hiti_seht2cxx . . $ hiti_seht2(9756742ab282b22d).(ctx, 3, o, HITI_HEATTABLE_V1_PLANESIZEcxx . . $ `src/cups/backend_hiti.c:321:9`!);
1898 }
1899
1900 /* And finally, send over the CVD data */
1901 if (!ret)
1902 ret = hiti_cvdcxx . . $ hiti_cvd(b1de4f2fc8046d60).(ctx, cvd, HITI_HEATTABLE_V1_CVDSIZEcxx . . $ `src/cups/backend_hiti.c:322:9`!);
1903
1904 return ret;
1905 }
1906
1907 /* HiTi's funky interpolation table processing
1908
1909 Note this is a standard "CUBE" LUT (33x33x33) so there are options
1910 for making this faster!
1911 */
1912 struct rgbcxx . . $ rgb# {
1913 uint8_tcxx . . $ uint8_t# rcxx . . $ rgb#r.;
1914 uint8_tcxx . . $ uint8_t# gcxx . . $ rgb#g.;
1915 uint8_tcxx . . $ uint8_t# bcxx . . $ rgb#b.;
1916 };
1917
1918 static uint32_tcxx . . $ uint32_t# interp1089cxx . . $ interp1089.[33];
1919 static uint32_tcxx . . $ uint32_t# interp33cxx . . $ interp33.[33];
1920 static uint16_tcxx . . $ uint16_t# interp256cxx . . $ interp256.[256*9];
1921
1922 static void hiti_interp_initcxx . . $ hiti_interp_init(49f6e7a06ebc5aa8).(void)
1923 {
1924 int i;
1925 uint16_tcxx . . $ uint16_t# *pre, *cur;
1926
1927 for (i = 0 ; i < 33 ; i++) {
1928 interp1089cxx . . $ interp1089.[i] = i * 1089;
1929 interp33cxx . . $ interp33.[i] = i * 33;
1930 }
1931 memsetcxx . . $ memset(d1de1e4fb215f1c6).(interp256cxx . . $ interp256., 0, sizeof(interp256cxx . . $ interp256.));
1932 pre = &interp256cxx . . $ interp256.[0];
1933 cur = &interp256cxx . . $ interp256.[256];
1934
1935 for (i = 1 ; i < 9 ; i++) {
1936 int j;
1937 for (j = 0 ; j < 256 ; j++) {
1938 cur[j] = pre[j] + j;
1939 };
1940 pre += 256;
1941 cur += 256;
1942 }
1943 }
1944
1945 /* src and dst are RGB tuples */
1946 static void hiti_interp33_256cxx . . $ hiti_interp33_256(32f263b1ae9708ff).(uint8_tcxx . . $ uint8_t# *dst, const uint8_tcxx . . $ uint8_t# *src, const uint8_tcxx . . $ uint8_t# *pTable)
1947 {
1948 struct rgbcxx . . $ rgb# p1_pos, p2_pos, p3_pos, p4_pos;
1949 struct rgbcxx . . $ rgb# p1_val, p2_val, p3_val, p4_val;
1950 uint8_tcxx . . $ uint8_t# r_weight, g_weight, b_weight;
1951 uint16_tcxx . . $ uint16_t# w1, w2, w3, w4;
1952 uint16_tcxx . . $ uint16_t# *pw1, *pw2, *pw3, *pw4;
1953 uint32_tcxx . . $ uint32_t# pos;
1954
1955 /* Get Grid position */
1956 p1_pos.rcxx . . $ rgb#r. = src[0] >> 3;
1957 p1_pos.gcxx . . $ rgb#g. = src[1] >> 3;
1958 p1_pos.bcxx . . $ rgb#b. = src[2] >> 3;
1959
1960 p4_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
1961 p4_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
1962 p4_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
1963
1964 /* Weights */
1965 if (src[0] == 255)
1966 r_weight = 8;
1967 else
1968 r_weight = src[0] & 0x7;
1969
1970 if (src[1] == 255)
1971 g_weight = 8;
1972 else
1973 g_weight = src[1] & 0x7;
1974
1975 if (src[2] == 255)
1976 b_weight = 8;
1977 else
1978 b_weight = src[2] & 0x7;
1979
1980 /* Work out relative weights and offsets */
1981 if (r_weight >= g_weight) {
1982 if (g_weight >= b_weight) { /* R > G > B */
1983 w1 = 8 - r_weight;
1984 w2 = r_weight - g_weight;
1985 w3 = g_weight - b_weight;
1986 w4 = b_weight;
1987 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
1988 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
1989 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
1990 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
1991 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
1992 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
1993 } else {
1994 if (r_weight >= b_weight) { /* R > B > G */
1995 w1 = 8 - r_weight;
1996 w2 = r_weight - b_weight;
1997 w3 = b_weight - g_weight;
1998 w4 = g_weight;
1999 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
2000 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
2001 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
2002 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
2003 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
2004 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2005 } else { /* B > R > G */
2006 w1 = 8 - b_weight;
2007 w2 = b_weight - r_weight;
2008 w3 = r_weight - g_weight;
2009 w4 = g_weight;
2010 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2011 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
2012 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2013 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
2014 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
2015 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2016 }
2017 }
2018 } else {
2019 if (r_weight >= b_weight) { /* G > R > B */
2020 w1 = 8 - g_weight;
2021 w2 = g_weight - r_weight;
2022 w3 = r_weight - b_weight;
2023 w4 = b_weight;
2024 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2025 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
2026 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
2027 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r. + 1;
2028 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
2029 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
2030 } else {
2031 if (g_weight >= b_weight) { /* G > B > R */
2032 w1 = 8 - g_weight;
2033 w2 = g_weight - b_weight;
2034 w3 = b_weight - r_weight;
2035 w4 = r_weight;
2036 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2037 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
2038 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b.;
2039 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2040 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
2041 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2042 } else { /* B > G > R */
2043 w1 = 8 - b_weight;
2044 w2 = b_weight - g_weight;
2045 w3 = g_weight - r_weight;
2046 w4 = r_weight;
2047 p2_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2048 p2_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g.;
2049 p2_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2050 p3_pos.rcxx . . $ rgb#r. = p1_pos.rcxx . . $ rgb#r.;
2051 p3_pos.gcxx . . $ rgb#g. = p1_pos.gcxx . . $ rgb#g. + 1;
2052 p3_pos.bcxx . . $ rgb#b. = p1_pos.bcxx . . $ rgb#b. + 1;
2053 }
2054 }
2055 }
2056
2057 /* Work out values */
2058 pos = (interp1089cxx . . $ interp1089.[p1_pos.bcxx . . $ rgb#b.] + interp33cxx . . $ interp33.[p1_pos.gcxx . . $ rgb#g.] + p1_pos.rcxx . . $ rgb#r.) * 3;
2059 p1_val.rcxx . . $ rgb#r. = pTable[pos];
2060 p1_val.gcxx . . $ rgb#g. = pTable[pos + 1];
2061 p1_val.bcxx . . $ rgb#b. = pTable[pos + 2];
2062 pos = (interp1089cxx . . $ interp1089.[p2_pos.bcxx . . $ rgb#b.] + interp33cxx . . $ interp33.[p2_pos.gcxx . . $ rgb#g.] + p2_pos.rcxx . . $ rgb#r.) * 3;
2063 p2_val.rcxx . . $ rgb#r. = pTable[pos];
2064 p2_val.gcxx . . $ rgb#g. = pTable[pos + 1];
2065 p2_val.bcxx . . $ rgb#b. = pTable[pos + 2];
2066 pos = (interp1089cxx . . $ interp1089.[p3_pos.bcxx . . $ rgb#b.] + interp33cxx . . $ interp33.[p3_pos.gcxx . . $ rgb#g.] + p3_pos.rcxx . . $ rgb#r.) * 3;
2067 p3_val.rcxx . . $ rgb#r. = pTable[pos];
2068 p3_val.gcxx . . $ rgb#g. = pTable[pos + 1];
2069 p3_val.bcxx . . $ rgb#b. = pTable[pos + 2];
2070 pos = (interp1089cxx . . $ interp1089.[p4_pos.bcxx . . $ rgb#b.] + interp33cxx . . $ interp33.[p4_pos.gcxx . . $ rgb#g.] + p4_pos.rcxx . . $ rgb#r.) * 3;
2071 p4_val.rcxx . . $ rgb#r. = pTable[pos];
2072 p4_val.gcxx . . $ rgb#g. = pTable[pos + 1];
2073 p4_val.bcxx . . $ rgb#b. = pTable[pos + 2];
2074
2075 /* Final offsets into interpolation table */
2076 pw1 = &interp256cxx . . $ interp256.[w1 << 8];
2077 pw2 = &interp256cxx . . $ interp256.[w2 << 8];
2078 pw3 = &interp256cxx . . $ interp256.[w3 << 8];
2079 pw4 = &interp256cxx . . $ interp256.[w4 << 8];
2080
2081 /* And at long last.. final values */
2082 dst[0] = (pw1[p1_val.rcxx . . $ rgb#r.] + pw2[p2_val.rcxx . . $ rgb#r.] + pw3[p3_val.rcxx . . $ rgb#r.] + pw4[p4_val.rcxx . . $ rgb#r.]) >> 3;
2083 dst[1] = (pw1[p1_val.gcxx . . $ rgb#g.] + pw2[p2_val.gcxx . . $ rgb#g.] + pw3[p3_val.gcxx . . $ rgb#g.] + pw4[p4_val.gcxx . . $ rgb#g.]) >> 3;
2084 dst[2] = (pw1[p1_val.bcxx . . $ rgb#b.] + pw2[p2_val.bcxx . . $ rgb#b.] + pw3[p3_val.bcxx . . $ rgb#b.] + pw4[p4_val.bcxx . . $ rgb#b.]) >> 3;
2085
2086 }
2087
2088 static int hiti630_compute_scorecxx . . $ hiti630_compute_score(620b9ac44d2573a6).(double mean)
2089 {
2090 int score = 9 - (int)(mean / 25.5);
2091 if (score < 0)
2092 return 0;
2093 if (score > 9)
2094 return 9;
2095 return score;
2096 }
2097
2098 static int hiti630_check_quality_16cxx . . $ hiti630_check_quality_16(25cf23d334e3090a).(int *scores, double *below40)
2099 {
2100 int total = 0;
2101
2102 int i;
2103
2104 for (i = 0 ; i < 16 ; i++)
2105 total += scores[i];
2106 if (total >= 112)
2107 return 1;
2108 if (scores[12] + scores[13] + scores[14] + scores[15] >= 35)
2109 return 2;
2110 for (total = 0, i = 0 ; i < 8 ; i++)
2111 total += scores[i];
2112 if (total >= 68)
2113 return 3;
2114 for (total = 0, i = 8 ; i < 16 ; i++)
2115 total += scores[i];
2116 if (total >= 68)
2117 return 4;
2118 if (scores[4] + scores[8] + scores[12] >= 26)
2119 return 5;
2120 if (scores[7] + scores[11] + scores[15] >= 26)
2121 return 6;
2122 if (scores[0] + scores[4] + scores[7] >= 26)
2123 return 7;
2124 if (scores[3] + scores[7] + scores[11] >= 26)
2125 return 8;
2126 if (scores[0] + scores[1] + scores[4] + scores[5] >= 34)
2127 return 9;
2128 if (scores[1] + scores[2] + scores[5] + scores[6] >= 34)
2129 return 10;
2130 if (scores[2] + scores[3] + scores[6] + scores[7] >= 34)
2131 return 11;
2132 if (scores[4] + scores[5] + scores[8] + scores[9] >= 34)
2133 return 12;
2134 if (scores[5] + scores[6] + scores[9] + scores[10] >= 34)
2135 return 13;
2136 if (scores[6] + scores[7] + scores[10] + scores[11] >= 34)
2137 return 14;
2138 if (scores[8] + scores[9] + scores[12] + scores[13] >= 34)
2139 return 15;
2140 if (scores[9] + scores[10] + scores[13] + scores[14] >= 34)
2141 return 16;
2142 if (scores[10] + scores[11] + scores[14] + scores[15] >= 34)
2143 return 17;
2144
2145 double avgPct = 0.0;
2146 for (i = 0 ; i < 16 ; i++)
2147 avgPct += below40[i];
2148 avgPct /= 16;
2149 if (avgPct >= 45.0)
2150 return 18; // rule "17-1"
2151
2152 return 0;
2153 }
2154
2155 static int hiti630_check_quality_32cxx . . $ hiti630_check_quality_32(25cf23d334e3090a).(int *scores, double *below40)
2156 {
2157 int total = 0;
2158
2159 int i;
2160
2161 for (i = 0 ; i < 32; i++)
2162 total += scores[i];
2163 if (total >= 232)
2164 return 19;
2165 for (total = 0, i = 16; i < 32; i++)
2166 total += scores[i];
2167 if (total >= 112)
2168 return 20;
2169 if (scores[28] + scores[29] + scores[30] + scores[31] >= 35)
2170 return 21;
2171 if (scores[20] + scores[24] + scores[28] >= 26)
2172 return 22;
2173 if (scores[23] + scores[27] + scores[31] >= 26)
2174 return 23;
2175 if (scores[16] + scores[20] + scores[24] >= 26)
2176 return 24;
2177 if (scores[19] + scores[23] + scores[27] >= 26)
2178 return 25;
2179 for (total = 0, i = 12; i < 20; i++)
2180 total += scores[i];
2181 if (total >= 68)
2182 return 26;
2183 for (total = 0, i = 16; i < 24; i++)
2184 total += scores[i];
2185 if (total >= 68)
2186 return 27;
2187 for (total = 0, i = 24; i < 31; i++)
2188 total += scores[i];
2189 if (total >= 68)
2190 return 28;
2191 if (scores[16] + scores[17] + scores[20] + scores[21] >= 34)
2192 return 29;
2193 if (scores[17] + scores[18] + scores[21] + scores[22] >= 34)
2194 return 30;
2195 if (scores[18] + scores[19] + scores[22] + scores[23] >= 34)
2196 return 31;
2197 if (scores[20] + scores[21] + scores[24] + scores[25] >= 34)
2198 return 32;
2199 if (scores[21] + scores[22] + scores[25] + scores[26] >= 34)
2200 return 33;
2201 if (scores[22] + scores[23] + scores[26] + scores[27] >= 34)
2202 return 34;
2203 if (scores[24] + scores[25] + scores[28] + scores[29] >= 34)
2204 return 35;
2205 if (scores[25] + scores[26] + scores[29] + scores[30] >= 34)
2206 return 36;
2207 if (scores[26] + scores[27] + scores[30] + scores[31] >= 34)
2208 return 37;
2209
2210 double avgPct = 0.0;
2211 for (i = 16; i < 32 ; i++)
2212 avgPct += below40[i];
2213 avgPct /= 16;
2214 if (avgPct >= 45.0)
2215 return 38; // rule "37-1"
2216
2217 for (avgPct = 0.0, i = 0; i < 32 ; i++)
2218 avgPct += below40[i];
2219 avgPct /= 16;
2220 if (avgPct >= 45.0)
2221 return 39; // rule "37-2"
2222
2223 return 0;
2224 }
2225
2226 static int hiti630_analyze_channelcxx . . $ hiti630_analyze_channel(d7c7c2193599a8dc).(const uint8_tcxx . . $ uint8_t# *imgdata, uint16_tcxx . . $ uint16_t# cols, uint16_tcxx . . $ uint16_t# rows, uint8_tcxx . . $ uint8_t# bpp, uint8_tcxx . . $ uint8_t# bshift)
2227 {
2228 int segments, seg_rows, seg_cols;
2229 int scores[32] = { 0 };
2230 int seg_w, seg_h;
2231 double below40[32] = { 0.0 };
2232
2233 if (rows <= 1240) {
2234 segments = 16; seg_rows = 4; seg_cols = 4;
2235 } else {
2236 segments = 32; seg_rows = 8; seg_cols = 4;
2237 }
2238 seg_w = cols /* - offset*2 */ / seg_cols;
2239 seg_h = rows / seg_rows;
2240
2241 for (int r = 0; r < seg_rows ; r++) {
2242 for (int c = 0; c < seg_cols ; c++) {
2243 int seg_idx = r * seg_cols + c;
2244 uint64_tcxx . . $ uint64_t# sum = 0;
2245 int count = 0;
2246 int below40_count = 0;
2247 for (int y = r * seg_h ; y < (r+1)*seg_h ; y++) {
2248 const uint8_tcxx . . $ uint8_t# *rptr = imgdata + (y * cols * bpp /* + offset*bpp*2 */ ) /* + offset*bpp */;
2249 int s = c * seg_w * bpp;
2250 for (int x = 0; x < seg_w; x++, s += bpp) {
2251 uint8_tcxx . . $ uint8_t# val = rptr[s + bshift]; /* ie a specific pixel's channel */
2252 sum += val;
2253 count ++;
2254 if (val < 40)
2255 below40_count++;
2256 }
2257 }
2258 double mean = (double)sum / count;
2259 scores[seg_idx] = hiti630_compute_scorecxx . . $ hiti630_compute_score(620b9ac44d2573a6).(mean);
2260 below40[seg_idx] = (double) below40_count / count * 100.0;
2261 }
2262 }
2263
2264 if (hiti630_check_quality_16cxx . . $ hiti630_check_quality_16(25cf23d334e3090a).(scores, below40))
2265 return 1;
2266 if (segments == 32)
2267 return hiti630_check_quality_32cxx . . $ hiti630_check_quality_32(25cf23d334e3090a).(scores, below40);
2268 return 0;
2269 }
2270
2271 static int hitip630_analyze_qualitycxx . . $ hitip630_analyze_quality(5188ba3ed4776032).(const uint8_tcxx . . $ uint8_t# *imgdata, uint16_tcxx . . $ uint16_t# cols, uint16_tcxx . . $ uint16_t# rows, uint8_tcxx . . $ uint8_t# bpp)
2272 {
2273 if (hiti630_analyze_channelcxx . . $ hiti630_analyze_channel(d7c7c2193599a8dc).(imgdata, cols, rows, bpp, 0)) /* B */
2274 return 1;
2275 if (hiti630_analyze_channelcxx . . $ hiti630_analyze_channel(d7c7c2193599a8dc).(imgdata, cols, rows, bpp, 1)) /* G */
2276 return 2;
2277 if (hiti630_analyze_channelcxx . . $ hiti630_analyze_channel(d7c7c2193599a8dc).(imgdata, cols, rows, bpp, 2)) /* R */
2278 return 3;
2279
2280 return 0;
2281 }
2282
2283
2284 static int hiti_read_parsecxx . . $ hiti_read_parse(296a7ce9eef68a26).(void *vctx, const void **vjob, int data_fd, int copies)
2285 {
2286 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
2287 struct hiti_printjobcxx . . $ hiti_printjob# *job = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2288 int ret;
2289
2290 if (!ctx)
2291 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2292
2293 job = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*job));
2294 if (!job) {
2295 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failure!\n");
2296 return CUPS_BACKEND_RETRY_CURRENTcxx . . $ `src/cups/backend_common.h:374:9`!;
2297 }
2298 memsetcxx . . $ memset(d1de1e4fb215f1c6).(job, 0, sizeof(*job));
2299 job->commoncxx . . $ hiti_printjob#common..jobsizecxx . . $ dyesub_job_common#jobsize. = sizeof(*job);
2300 job->commoncxx . . $ hiti_printjob#common..copiescxx . . $ dyesub_job_common#copies. = copies;
2301
2302 /* Read in header */
2303 ret = readcxx . . $ read(7e34d0a36f355389).(data_fd, &job->hdrcxx . . $ hiti_printjob#hdr., sizeof(job->hdrcxx . . $ hiti_printjob#hdr.));
2304 if (ret < 0 || ret != sizeof(job->hdrcxx . . $ hiti_printjob#hdr.)) {
2305 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2306 if (ret == 0)
2307 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2308
2309 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Read failed (%d/%d)\n",
2310 ret, (int)sizeof(job->hdr));
2311 perrorcxx . . $ perror(85c52e162fed56f9).("ERROR: Read failed");
2312 return ret;
2313 }
2314
2315 /* Byteswap everything */
2316 {
2317 uint32_tcxx . . $ uint32_t# *ptr = (uint32_tcxx . . $ uint32_t#*) &job->hdrcxx . . $ hiti_printjob#hdr.;
2318 int i;
2319 for (i = 0 ; i < (int)(sizeof(job->hdrcxx . . $ hiti_printjob#hdr.) / sizeof(uint32_tcxx . . $ uint32_t#)) ; i++)
2320 ptr[i] = le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(ptr[i]);
2321 }
2322
2323 /* Sanity check header */
2324 if (job->hdrcxx . . $ hiti_printjob#hdr..hdr_lencxx . . $ hiti_gpjobhdr#hdr_len. != sizeof(job->hdrcxx . . $ hiti_printjob#hdr.)) {
2325 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Header length mismatch (%u/%d)!\n", job->hdr.hdr_len, (int)sizeof(job->hdr));
2326 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2327 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2328 }
2329 if (job->hdrcxx . . $ hiti_printjob#hdr..cookiecxx . . $ hiti_gpjobhdr#cookie. != HDR_COOKIEcxx . . $ `src/cups/backend_hiti.c:436:9`!) {
2330 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2331 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2332 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2333 }
2334
2335 /* Use larger of our copy counts */
2336 if (job->commoncxx . . $ hiti_printjob#common..copiescxx . . $ dyesub_job_common#copies. < (int)job->hdrcxx . . $ hiti_printjob#hdr..copiescxx . . $ hiti_gpjobhdr#copies.)
2337 job->commoncxx . . $ hiti_printjob#common..copiescxx . . $ dyesub_job_common#copies. = job->hdrcxx . . $ hiti_printjob#hdr..copiescxx . . $ hiti_gpjobhdr#copies.;
2338
2339 /* Sanity check printer type vs job type */
2340 switch(ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type.) {
2341 // XXX add P11x
2342 case P_HITI_310cxx . . $ P_HITI_310.: // XXX
2343 case P_HITI_320cxx . . $ P_HITI_320.: // XXX
2344 case P_HITI_461cxx . . $ P_HITI_461.:
2345 if (job->hdrcxx . . $ hiti_printjob#hdr..modelcxx . . $ hiti_gpjobhdr#model. != 461) {
2346 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2347 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2348 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2349 }
2350 break;
2351 case P_HITI_51Xcxx . . $ P_HITI_51X.:
2352 if (job->hdrcxx . . $ hiti_printjob#hdr..modelcxx . . $ hiti_gpjobhdr#model. != 510) {
2353 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2354 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2355 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2356 }
2357 break;
2358 case P_HITI_520cxx . . $ P_HITI_520.:
2359 case P_HITI_525cxx . . $ P_HITI_525.:
2360 case P_HITI_530cxx . . $ P_HITI_530.: // XXX
2361 case P_HITI_826cxx . . $ P_HITI_826.:
2362 case P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10.:
2363 if (job->hdrcxx . . $ hiti_printjob#hdr..modelcxx . . $ hiti_gpjobhdr#model. != 520) {
2364 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2365 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2366 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2367 }
2368 break;
2369 case P_HITI_630cxx . . $ P_HITI_630.:
2370 if (job->hdrcxx . . $ hiti_printjob#hdr..modelcxx . . $ hiti_gpjobhdr#model. != 630) {
2371 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2372 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2373 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2374 }
2375 break;
2376 case P_HITI_720cxx . . $ P_HITI_720.:
2377 case P_HITI_750cxx . . $ P_HITI_750.:
2378 if (job->hdrcxx . . $ hiti_printjob#hdr..modelcxx . . $ hiti_gpjobhdr#model. != 720) {
2379 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unrecognized header!\n");
2380 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2381 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2382 }
2383 break;
2384 default:
2385 break;
2386 }
2387
2388 /* Allocate a buffer */
2389 job->datalencxx . . $ hiti_printjob#datalen. = 0;
2390 job->databufcxx . . $ hiti_printjob#databuf. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(job->hdrcxx . . $ hiti_printjob#hdr..payload_lencxx . . $ hiti_gpjobhdr#payload_len.);
2391 if (!job->databufcxx . . $ hiti_printjob#databuf.) {
2392 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failure!\n");
2393 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2394 return CUPS_BACKEND_RETRY_CURRENTcxx . . $ `src/cups/backend_common.h:374:9`!;
2395 }
2396
2397 /* Read in data */
2398 uint32_tcxx . . $ uint32_t# remain = job->hdrcxx . . $ hiti_printjob#hdr..payload_lencxx . . $ hiti_gpjobhdr#payload_len.;
2399 while (remain) {
2400 ret = readcxx . . $ read(7e34d0a36f355389).(data_fd, job->databufcxx . . $ hiti_printjob#databuf. + job->datalencxx . . $ hiti_printjob#datalen., remain);
2401 if (ret < 0) {
2402 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Read failed (%d/%u/%u)\n",
2403 ret, remain, job->datalen);
2404 perrorcxx . . $ perror(85c52e162fed56f9).("ERROR: Read failed");
2405 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2406 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2407 }
2408 job->datalencxx . . $ hiti_printjob#datalen. += ret;
2409 remain -= ret;
2410 }
2411
2412 /* Sanity check against paper */
2413 switch (ctx->papercxx . . $ hiti_ctx#paper..typecxx . . $ hiti_paper#type.) {
2414 case PAPER_TYPE_X4INCHcxx . . $ `src/cups/backend_hiti.c:575:9`!:
2415 // XXX P461/P320/P310 is 1280
2416 // XXX P11x is ???
2417 if (job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. != ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols.) {
2418 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Illegal job on 4x6-inch paper!\n");
2419 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2420 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2421 }
2422 break;
2423 case PAPER_TYPE_5INCHcxx . . $ `src/cups/backend_hiti.c:576:9`!:
2424 if (!(job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. & PAYLOAD_FLAG_YMCPLANARcxx . . $ `src/cups/backend_hiti.c:429:9`!) &&
2425 job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. == 1548)
2426 break;
2427 /* Intentional fallthrough */
2428 case PAPER_TYPE_6INCHcxx . . $ `src/cups/backend_hiti.c:577:9`!:
2429 if (job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. != ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols.) {
2430 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Illegal job on %d-inch paper!\n", ctx->paper.type == PAPER_TYPE_5INCHcxx . . $ `src/cups/backend_hiti.c:576:9`! ? 5 : 6);
2431 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2432 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2433 }
2434 break;
2435 default:
2436 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unknown paper type (%d)!\n", ctx->paper.type);
2437 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2438 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2439 }
2440
2441 /* Sanity check against ribbon type */
2442 switch (ctx->ribboncxx . . $ hiti_ctx#ribbon..typecxx . . $ hiti_ribbon#type.) {
2443 case RIBBON_TYPE_4x6cxx . . $ `src/cups/backend_hiti.c:564:9`!:
2444 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! &&
2445 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! &&
2446 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`! &&
2447 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x2cxx . . $ `src/cups/backend_hiti.c:299:9`!) {
2448 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Invalid ribbon type vs job (%02x/%02x)\n",
2449 ctx->ribbon.type, job->hdr.code);
2450 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2451 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2452 }
2453 break;
2454 case RIBBON_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:565:9`!:
2455 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:293:9`! &&
2456 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x3_5cxx . . $ `src/cups/backend_hiti.c:297:9`! &&
•2457 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x5cxx . . $ `src/cups/backend_hiti.c:306:9`! &&
2458 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x7_2UPcxx . . $ `src/cups/backend_hiti.c:300:9`!) {
2459 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Invalid ribbon type vs job (%02x/%02x)\n",
2460 ctx->ribbon.type, job->hdr.code);
2461 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2462 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2463 }
2464 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_5x3_5cxx . . $ `src/cups/backend_hiti.c:297:9`!)
2465 job->commoncxx . . $ hiti_printjob#common..can_combinecxx . . $ dyesub_job_common#can_combine. = 1;
2466 break;
2467 case RIBBON_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:567:9`!:
2468 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! &&
2469 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! &&
2470 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`! &&
2471 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x5cxx . . $ `src/cups/backend_hiti.c:304:9`! &&
2472 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x6cxx . . $ `src/cups/backend_hiti.c:305:9`! &&
2473 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:294:9`! &&
2474 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x2cxx . . $ `src/cups/backend_hiti.c:299:9`! &&
2475 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_2UPcxx . . $ `src/cups/backend_hiti.c:296:9`! &&
2476 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_4UPcxx . . $ `src/cups/backend_hiti.c:302:9`! &&
2477 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_6UPcxx . . $ `src/cups/backend_hiti.c:303:9`! &&
2478 /* HiTi now supplies 6x8" ribbons in 5x7" kits */
2479 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x7cxx . . $ `src/cups/backend_hiti.c:293:9`! &&
2480 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x3_5cxx . . $ `src/cups/backend_hiti.c:297:9`! &&
2481 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_5x7_2UPcxx . . $ `src/cups/backend_hiti.c:300:9`! ) {
2482 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Invalid ribbon type vs job (%02x/%02x)\n",
2483 ctx->ribbon.type, job->hdr.code);
2484 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2485 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2486 }
2487 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! ||
2488 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! ||
2489 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`! ||
2490 /* 5x7" prints on 6x8" ribbons... */
2491 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_5x3_5cxx . . $ `src/cups/backend_hiti.c:297:9`!)
2492 job->commoncxx . . $ hiti_printjob#common..can_combinecxx . . $ dyesub_job_common#can_combine. = 1;
2493 break;
2494 case RIBBON_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:566:9`!:
2495 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! &&
2496 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! &&
2497 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`! &&
2498 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x5cxx . . $ `src/cups/backend_hiti.c:304:9`! &&
2499 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x6cxx . . $ `src/cups/backend_hiti.c:305:9`! &&
2500 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x8cxx . . $ `src/cups/backend_hiti.c:294:9`! &&
2501 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x2cxx . . $ `src/cups/backend_hiti.c:299:9`! &&
2502 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9cxx . . $ `src/cups/backend_hiti.c:295:9`! &&
2503 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_2UPcxx . . $ `src/cups/backend_hiti.c:296:9`! &&
2504 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_4UPcxx . . $ `src/cups/backend_hiti.c:302:9`! &&
2505 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. != PRINT_TYPE_6x9_6UPcxx . . $ `src/cups/backend_hiti.c:303:9`!) {
2506 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Invalid ribbon type vs job (%02x/%02x)\n",
2507 ctx->ribbon.type, job->hdr.code);
2508 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2509 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2510 }
2511 if (job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4cxx . . $ `src/cups/backend_hiti.c:292:9`! ||
2512 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4_2UPcxx . . $ `src/cups/backend_hiti.c:298:9`! ||
2513 job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`!)
2514 job->commoncxx . . $ hiti_printjob#common..can_combinecxx . . $ dyesub_job_common#can_combine. = 1;
2515 break;
2516 default:
2517 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unknown ribbon type (%d)!\n", ctx->ribbon.type);
2518 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2519 return CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`!;
2520 }
2521
2522 /* Set color mode / media class */
2523 if (job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. & PAYLOAD_FLAG_MEDIATYPEcxx . . $ `src/cups/backend_hiti.c:432:9`!) {
2524 job->colormodecxx . . $ hiti_printjob#colormode. = job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. >> PAYLOAD_FLAG_DATA_SHIFTcxx . . $ `src/cups/backend_hiti.c:434:9`!;
2525 } else {
2526 job->colormodecxx . . $ hiti_printjob#colormode. = HT_COLORMODE_IDPASS_VIVIDcxx . . $ HT_COLORMODE_IDPASS_VIVID.;
2527 }
2528
2529 int ribbonvendor = ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor.;
2530 if (job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. & PAYLOAD_FLAG_MEDIAVERcxx . . $ `src/cups/backend_hiti.c:431:9`!) {
2531 ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor. &= ~RRVC_VERSION_MASKcxx . . $ `src/cups/backend_hiti.c:668:9`!;
2532 ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor. |= ((job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. >> PAYLOAD_FLAG_DATA_SHIFTcxx . . $ `src/cups/backend_hiti.c:434:9`!) & RRVC_VERSION_MASKcxx . . $ `src/cups/backend_hiti.c:668:9`!);
2533 }
2534
2535 /* Convert input packed BGR data into YMC planar, if needed */
2536 if (!(job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. & PAYLOAD_FLAG_YMCPLANARcxx . . $ `src/cups/backend_hiti.c:429:9`!)) {
2537
2538 /* Perform "quality" analysis */
2539 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_630cxx . . $ P_HITI_630. && !job->hdrcxx . . $ hiti_printjob#hdr..qualitycxx . . $ hiti_gpjobhdr#quality.) {
2540 if (hitip630_analyze_qualitycxx . . $ hitip630_analyze_quality(5188ba3ed4776032).(job->databufcxx . . $ hiti_printjob#databuf., job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols., job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows., 3)) {
2541 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Promoting job to high quality mode\n");
2542 job->hdrcxx . . $ hiti_printjob#hdr..qualitycxx . . $ hiti_gpjobhdr#quality. = 1;
2543 // XXX how does this interact with metallic etc media?
2544 }
2545 }
2546
2547 /* Load up correction data, if requested */
2548 uint8_tcxx . . $ uint8_t# *corrdata = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2549 if (!(job->hdrcxx . . $ hiti_printjob#hdr..payload_flagcxx . . $ hiti_gpjobhdr#payload_flag. & PAYLOAD_FLAG_NOCORRECTcxx . . $ `src/cups/backend_hiti.c:430:9`!)) {
2550 corrdata = hiti_get_correction_datacxx . . $ hiti_get_correction_data(31c88ba2c60ae85b).(ctx, job->hdrcxx . . $ hiti_printjob#hdr..qualitycxx . . $ hiti_gpjobhdr#quality., job->colormodecxx . . $ hiti_printjob#colormode., ribbonvendor);
2551 if (corrdata) {
2552 hiti_interp_initcxx . . $ hiti_interp_init(49f6e7a06ebc5aa8).();
2553 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Running input data through correction tables\n");
2554 }
2555 }
2556
2557 /* Printer expects FULL WIDTH data, even for 5" prints */
2558 int pad1, pad2;
2559 pad1 = (ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. - job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols.) / 2;
2560 pad2 = ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. - job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. - pad1;
2561
2562 uint8_tcxx . . $ uint8_t# *ymcbuf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. * ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. * 3);
2563 uint32_tcxx . . $ uint32_t# i, j;
2564
2565 if (!ymcbuf) {
2566 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(job);
2567 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory Allocation Failure!\n");
2568 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2569 }
2570
2571 for (i = 0 ; i < job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. ; i++) {
2572 uint8_tcxx . . $ uint8_t# *rowY = ymcbuf + ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. * i;
2573 uint8_tcxx . . $ uint8_t# *rowM = ymcbuf + ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. * (job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. + i);
2574 uint8_tcxx . . $ uint8_t# *rowC = ymcbuf + ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. * (job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. * 2 + i);
2575
2576 /* Simple optimization */
2577 uint8_tcxx . . $ uint8_t# oldrgb[3] = { 255, 255, 255 };
2578 uint8_tcxx . . $ uint8_t# destrgb[3];
2579
2580 if (corrdata) {
2581 hiti_interp33_256cxx . . $ hiti_interp33_256(32f263b1ae9708ff).(destrgb, oldrgb, corrdata);
2582 }
2583
2584 /* Leading Padding */
2585 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowY, 0, pad1);
2586 rowY += pad1;
2587 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowM, 0, pad1);
2588 rowM += pad1;
2589 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowC, 0, pad1);
2590 rowC += pad1;
2591
2592 for (j = 0 ; j < job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. ; j++) {
2593 uint8_tcxx . . $ uint8_t# rgb[3];
2594 uint32_tcxx . . $ uint32_t# base = (job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. * i + j) * 3;
2595
2596 /* Input data is BGR */
2597 rgb[2] = job->databufcxx . . $ hiti_printjob#databuf.[base];
2598 rgb[1] = job->databufcxx . . $ hiti_printjob#databuf.[base + 1];
2599 rgb[0] = job->databufcxx . . $ hiti_printjob#databuf.[base + 2];
2600
2601 if (corrdata) {
2602 if (rgb[0] == oldrgb[0] &&
2603 rgb[1] == oldrgb[1] &&
2604 rgb[2] == oldrgb[2]) {
2605 rgb[0] = destrgb[0];
2606 rgb[1] = destrgb[1];
2607 rgb[2] = destrgb[2];
2608 } else {
2609 oldrgb[0] = rgb[0];
2610 oldrgb[1] = rgb[1];
2611 oldrgb[2] = rgb[2];
2612 hiti_interp33_256cxx . . $ hiti_interp33_256(32f263b1ae9708ff).(rgb, rgb, corrdata);
2613 destrgb[0] = rgb[0];
2614 destrgb[1] = rgb[1];
2615 destrgb[2] = rgb[2];
2616 }
2617 }
2618
2619 /* Finally convert to YMC */
2620 rowY[j] = 255 - rgb[2];
2621 rowM[j] = 255 - rgb[1];
2622 rowC[j] = 255 - rgb[0];
2623 }
2624
2625 /* Trailing Padding */
2626 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowY + job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols., 0, pad2);
2627 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowM + job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols., 0, pad2);
2628 memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowC + job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols., 0, pad2);
2629 }
2630
2631 /* Nuke the old BGR buffer and replace it with YMC buffer */
2632 freecxx . . $ free(5d22bdacc48458e8).(job->databufcxx . . $ hiti_printjob#databuf.);
2633 job->databufcxx . . $ hiti_printjob#databuf. = ymcbuf;
2634 job->datalencxx . . $ hiti_printjob#datalen. = ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols. * 3 * job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols.;
2635 job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. = ctx->erdc_rscxx . . $ hiti_ctx#erdc_rs..colscxx . . $ hiti_erdc_rs#cols.;
2636
2637 if (corrdata)
2638 freecxx . . $ free(5d22bdacc48458e8).(corrdata);
2639 }
2640
2641 /* Read in heat table for job */
2642 job->heattable_bufcxx . . $ hiti_printjob#heattable_buf. = hiti_get_heat_datacxx . . $ hiti_get_heat_data(28d1560eef524a37).(ctx, job->hdrcxx . . $ hiti_printjob#hdr..qualitycxx . . $ hiti_gpjobhdr#quality., job->colormodecxx . . $ hiti_printjob#colormode., ribbonvendor, &job->heattable_lencxx . . $ hiti_printjob#heattable_len.);
2643
2644 if (job->heattable_bufcxx . . $ hiti_printjob#heattable_buf. &&
2645 ctx->heattable_typecxx . . $ hiti_ctx#heattable_type. == HEATTABLE_TYPE_V2cxx . . $ HEATTABLE_TYPE_V2.) {
2646 ret = hiti_parse_heattable_v2cxx . . $ hiti_parse_heattable_v2(6171dc793ae4f88a).(job);
2647 if (ret) {
2648 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Failed to parse v2 heattable, ignoring!\n");
2649 job->heattable_lencxx . . $ hiti_printjob#heattable_len. = 0;
2650 }
2651 uint32_tcxx . . $ uint32_t# ver_maj = -1;
2652 uint32_tcxx . . $ uint32_t# ver_min = -1;
2653
2654 void *dat;
2655 size_t len;
2656
2657 dat = hiti_find_heattable_v2_entrycxx . . $ hiti_find_heattable_v2_entry(816ea6d80e1ec686).(job, HEATTABLE_V2_ID_VER_MAJORcxx . . $ `src/cups/backend_hiti.c:353:9`!, &len);
2658 if (dat) {
2659 memcpycxx . . $ memcpy(cc817cb175f282d).(&ver_maj, dat, sizeof(ver_maj));
2660 ver_maj = le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(ver_maj);
2661 }
2662 dat = hiti_find_heattable_v2_entrycxx . . $ hiti_find_heattable_v2_entry(816ea6d80e1ec686).(job, HEATTABLE_V2_ID_VER_MINORcxx . . $ `src/cups/backend_hiti.c:354:9`!, &len);
2663 if (dat) {
2664 memcpycxx . . $ memcpy(cc817cb175f282d).(&ver_min, dat, sizeof(ver_min));
2665 ver_min = le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(ver_min);
2666 }
2667 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Heattable version %08x.%08x\n", ver_maj, ver_min);
2668
2669 /* Assemble SHPTC table for specific job requirements */
2670 void *shptc_buf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(HEATTABLE_V2_MAX_SIZEcxx . . $ `src/cups/backend_hiti.c:336:9`!);
2671 if (!shptc_buf) {
2672 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failure\n");
2673 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2674 }
2675 struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# *table = shptc_buf;
2676
2677 int planes = HT_PLANE_Ycxx . . $ HT_PLANE_Y. | HT_PLANE_Mcxx . . $ HT_PLANE_M. | HT_PLANE_Ccxx . . $ HT_PLANE_C. | HT_CVDcxx . . $ HT_CVD.;
2678 planes |= (job->hdrcxx . . $ hiti_printjob#hdr..overcoatcxx . . $ hiti_gpjobhdr#overcoat.) ? HT_PLANE_OMcxx . . $ HT_PLANE_OM. : HT_PLANE_OGcxx . . $ HT_PLANE_OG.;
2679
2680 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_630cxx . . $ P_HITI_630.)
2681 planes |= HT_PLANE_630Xcxx . . $ HT_PLANE_630X.;
2682
2683 ret = hiti_construct_heattable_v2cxx . . $ hiti_construct_heattable_v2(6f0ee2c8f7bc776c).(job, planes, job->colormodecxx . . $ hiti_printjob#colormode., table);
2684 if (ret) {
2685 job->heattable_lencxx . . $ hiti_printjob#heattable_len. = 0;
2686 } else {
2687 int datalen = 1 + table->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers. * sizeof(struct hiti_heattable_entry_v2cxx . . $ hiti_heattable_entry_v2#);
2688
2689 for (int i = 0 ; i < table->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers.; i++) {
2690 dat = hiti_find_heattable_v2_entrycxx . . $ hiti_find_heattable_v2_entry(816ea6d80e1ec686).(job, table->entriescxx . . $ hiti_heattable_hdr_v2#entries.[i].typecxx . . $ hiti_heattable_entry_v2#type., &len);
2691 table->entriescxx . . $ hiti_heattable_hdr_v2#entries.[i].lencxx . . $ hiti_heattable_entry_v2#len. = cpu_to_le32cxx . . $ `src/cups/backend_common.h:79:9`!(len);
2692 table->entriescxx . . $ hiti_heattable_hdr_v2#entries.[i].offsetcxx . . $ hiti_heattable_entry_v2#offset. = cpu_to_le32cxx . . $ `src/cups/backend_common.h:79:9`!(datalen);
2693 memcpycxx . . $ memcpy(cc817cb175f282d).(((uint8_tcxx . . $ uint8_t#*)shptc_buf)+datalen, dat, len);
2694
2695 if (dyesub_debugcxx . . $ dyesub_debug.)
2696 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Job entry: %02x len %lu @ %d\n", table->entries[i].type, len, datalen);
2697
2698 datalen += len;
2699 }
2700 freecxx . . $ free(5d22bdacc48458e8).(job->heattable_bufcxx . . $ hiti_printjob#heattable_buf.);
2701 job->heattable_bufcxx . . $ hiti_printjob#heattable_buf. = shptc_buf;
2702 job->heattable_lencxx . . $ hiti_printjob#heattable_len. = datalen;
2703
2704 freecxx . . $ free(5d22bdacc48458e8).(job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.);
2705 job->heattable_v2cxx . . $ hiti_printjob#heattable_v2. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2706 job->num_heattable_entriescxx . . $ hiti_printjob#num_heattable_entries. = 0;
2707 }
2708 }
2709
2710 *vjob = job;
2711
2712 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
2713 }
2714
2715 static int calc_offsetcxx . . $ calc_offset(d4c1ccc1fe1a56c0).(int val, int mid, int max, int step)
2716 {
2717 if (val == 0 || mid == 0)
2718 goto done;
2719
2720 if (val > max)
2721 val = max;
2722 else if (val < 0)
2723 val = 0;
2724
2725 val -= mid;
2726 val *= step;
2727
2728 done:
2729 return val;
2730 }
2731
2732 static int hiti_main_loopcxx . . $ hiti_main_loop(91e54fd90adbb21).(void *vctx, const void *vjob, int wait_for_return)
2733 {
2734 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
2735
2736 int ret;
2737 uint32_tcxx . . $ uint32_t# err = 0;
2738 uint8_tcxx . . $ uint8_t# sts[3];
2739 struct hiti_jobcxx . . $ hiti_job# jobid;
2740
2741 const struct hiti_printjobcxx . . $ hiti_printjob# *job = vjob;
2742
2743 if (!ctx)
2744 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2745 if (!job)
2746 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2747
2748 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Waiting for printer idle\n");
2749
2750 do {
2751 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
2752 if (ret)
2753 return ret;
2754
2755 /* If we have an error state, bail! */
2756 if (err) {
2757 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported alert: %08x (%s)\n",
2758 err, hiti_errors(err));
2759 return CUPS_BACKEND_STOPcxx . . $ `src/cups/backend_common.h:371:9`!;
2760 }
2761
2762 /* If we're able to accept jobs, proceed */
2763 if (!(sts[0] & (STATUS0_POWERONcxx . . $ `src/cups/backend_hiti.c:923:9`!|STATUS0_BUSYcxx . . $ `src/cups/backend_hiti.c:925:9`!)))
2764 break;
2765
2766 sleepcxx . . $ sleep(2141b656ce2cc063).(1);
2767 } while(1);
2768
2769 dump_markerscxx . . $ dump_markers(5d6a6527eb135db2).(&ctx->markercxx . . $ hiti_ctx#marker., 1, 0);
2770
2771 uint16_tcxx . . $ uint16_t# resplen = 0;
2772 uint16_tcxx . . $ uint16_t# rows = job->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows.;
2773 uint16_tcxx . . $ uint16_t# cols = ((4*job->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols.) + 3) / 4;
2774
2775 // XXX these two only need to change if rows > 3000
2776 uint16_tcxx . . $ uint16_t# startLine = 0;
2777 uint16_tcxx . . $ uint16_t# numLines = rows;
2778
2779 uint32_tcxx . . $ uint32_t# sent = 0;
2780
2781 /* Set up and send over Sublimation Format */
2782 struct hiti_efd_sfcxx . . $ hiti_efd_sf# sf;
2783 sf.mediaTypecxx . . $ hiti_efd_sf#mediaType. = job->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code.;
2784 sf.cols_rescxx . . $ hiti_efd_sf#cols_res. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(job->hdr.col_dpi);
2785 sf.rows_rescxx . . $ hiti_efd_sf#rows_res. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(job->hdr.row_dpi);
2786 sf.colscxx . . $ hiti_efd_sf#cols. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(job->hdr.cols);
2787 sf.rowscxx . . $ hiti_efd_sf#rows. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(rows);
2788 sf.rows_offsetcxx . . $ hiti_efd_sf#rows_offset. = calc_offsetcxx . . $ calc_offset(d4c1ccc1fe1a56c0).(5, ctx->calibrationcxx . . $ hiti_ctx#calibration..rowscxx . . $ hiti_calibration#rows., 8, 4);
2789 sf.cols_offsetcxx . . $ hiti_efd_sf#cols_offset. = calc_offsetcxx . . $ calc_offset(d4c1ccc1fe1a56c0).(ctx->calibrationcxx . . $ hiti_ctx#calibration..colscxx . . $ hiti_calibration#cols., 6, 11, 4);
2790 sf.colorSeqcxx . . $ hiti_efd_sf#colorSeq. = SF_COLORSEQ_YMCOcxx . . $ `src/cups/backend_hiti.c:463:9`! | (job->hdrcxx . . $ hiti_printjob#hdr..overcoatcxx . . $ hiti_gpjobhdr#overcoat. ? SF_COLORSEQ_MATTEcxx . . $ `src/cups/backend_hiti.c:464:9`! : 0);
2791 sf.copiescxx . . $ hiti_efd_sf#copies. = job->commoncxx . . $ hiti_printjob#common..copiescxx . . $ dyesub_job_common#copies.;
2792 sf.printModecxx . . $ hiti_efd_sf#printMode. = ctx->sheetcxx . . $ hiti_ctx#sheet. ? 0 : SF_PRINTMODE_BASEcxx . . $ `src/cups/backend_hiti.c:469:9`! + (job->hdrcxx . . $ hiti_printjob#hdr..qualitycxx . . $ hiti_gpjobhdr#quality. ? SF_PRINTMODE_FINEcxx . . $ `src/cups/backend_hiti.c:468:9`! : 0);
2793 memsetcxx . . $ memset(d1de1e4fb215f1c6).(sf.zerocxx . . $ hiti_efd_sf#zero., 0, sizeof(sf.zerocxx . . $ hiti_efd_sf#zero.));
2794 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EFD_SFcxx . . $ `src/cups/backend_hiti.c:121:9`!, (uint8_tcxx . . $ uint8_t#*) &sf,
2795 ctx->sheetcxx . . $ hiti_ctx#sheet. ? sizeof(sf) : sizeof(sf)-4 ,
2796 &resplen);
2797 if (ret)
2798 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2799
2800 // XXX on P461, P310/P322, P630: (and maybe 320?)
2801 // request warning
2802 // QJC
2803 // then SF again
2804
2805 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_520cxx . . $ P_HITI_520. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_525cxx . . $ P_HITI_525. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_826cxx . . $ P_HITI_826. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10. || ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_630cxx . . $ P_HITI_630.) {
2806 uint8_tcxx . . $ uint8_t# val = 0; /* table index */
2807 resplen = sizeof(&ctx->rhtvcxx . . $ hiti_ctx#rhtv.);
2808 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RHTVcxx . . $ `src/cups/backend_hiti.c:117:9`!, &val,
2809 sizeof(val), (uint8_tcxx . . $ uint8_t#*) &ctx->rhtvcxx . . $ hiti_ctx#rhtv., &resplen);
2810 if (ret)
2811 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2812 ctx->rhtvcxx . . $ hiti_ctx#rhtv..majorcxx . . $ hiti_rhtv#major. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(ctx->rhtv.major);
2813 ctx->rhtvcxx . . $ hiti_ctx#rhtv..minorcxx . . $ hiti_rhtv#minor. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(ctx->rhtv.minor);
2814 // Unclear if we meaningfully _care_ about this in any way
2815 }
2816
2817 /* Initialize jobid structure */
2818 jobid.luncxx . . $ hiti_job#lun. = 0;
2819 jobid.jobidcxx . . $ hiti_job#jobid. = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(ctx->jobid);
2820
2821 resplen = sizeof(jobid);
2822 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_JC_SJcxx . . $ `src/cups/backend_hiti.c:96:9`!, (uint8_tcxx . . $ uint8_t#*) &jobid, sizeof(jobid),
2823 (uint8_tcxx . . $ uint8_t#*) &jobid, &resplen);
2824 if (ret)
2825 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2826
2827 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Printer returned Job ID %04x\n", be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(jobid.jobid));
2828
2829 if (job->heattable_lencxx . . $ hiti_printjob#heattable_len. && !ctx->nodatacxx . . $ hiti_ctx#nodata.) {
2830 switch(ctx->heattable_typecxx . . $ hiti_ctx#heattable_type.) {
2831 case HEATTABLE_TYPE_V0cxx . . $ HEATTABLE_TYPE_V0.:
2832 if (job->heattable_lencxx . . $ hiti_printjob#heattable_len. == HEATTABLE_S_SIZEcxx . . $ `src/cups/backend_hiti.c:338:9`! || job->heattable_lencxx . . $ hiti_printjob#heattable_len. == HEATTABLE_S2_SIZEcxx . . $ `src/cups/backend_hiti.c:339:9`!) {
2833 /* Send ESC_SHPTC with entire file contents */
2834 ret = hiti_shptccxx . . $ hiti_shptc(b1de4f2fc8046d60).(ctx, job->heattable_bufcxx . . $ hiti_printjob#heattable_buf., job->heattable_lencxx . . $ hiti_printjob#heattable_len.);
2835 } else {
2836 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Unexpected heattable size (%d vs %d/%d)\n", job->heattable_len, HEATTABLE_S_SIZEcxx . . $ `src/cups/backend_hiti.c:338:9`!, HEATTABLE_S2_SIZEcxx . . $ `src/cups/backend_hiti.c:339:9`!);
2837 ret = CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2838 }
2839 break;
2840 case HEATTABLE_TYPE_V1cxx . . $ HEATTABLE_TYPE_V1.:
2841 ret = hiti_send_heat_data_v1cxx . . $ hiti_send_heat_data_v1(70d59b1d0db9a632).(ctx, job->heattable_bufcxx . . $ hiti_printjob#heattable_buf., job->heattable_lencxx . . $ hiti_printjob#heattable_len., job->hdrcxx . . $ hiti_printjob#hdr..overcoatcxx . . $ hiti_gpjobhdr#overcoat.);
2842 break;
2843 case HEATTABLE_TYPE_V2cxx . . $ HEATTABLE_TYPE_V2.:
2844 /* Just send the computed blob over */
2845 ret = hiti_shptccxx . . $ hiti_shptc(b1de4f2fc8046d60).(ctx, job->heattable_bufcxx . . $ hiti_printjob#heattable_buf., job->heattable_lencxx . . $ hiti_printjob#heattable_len.);
2846 break;
2847 }
2848 #if 0
2849 if (ctx->conn->type == P_HITI_51X) {
2850 uint8_t esd_unka[4] = { 0x00, 0x87, 0x00, 0x02 }; // XXX figure me out eventually?
2851 ret = hiti_docmd(ctx, CMD_ESD_UNKA, esd_unka, sizeof(esd_unka), &resplen);
2852 if (ret)
2853 return CUPS_BACKEND_FAILED;
2854 }
2855 #endif
2856 }
2857
2858 /* If we don't have a heat file or the heat transfer failed, revert to default tables */
2859 if (!job->heattable_lencxx . . $ hiti_printjob#heattable_len. || ret) {
2860 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_525cxx . . $ P_HITI_525. && ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_826cxx . . $ P_HITI_826. && ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10. && ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. != P_HITI_630cxx . . $ P_HITI_630.) {
2861 uint8_tcxx . . $ uint8_t# chs[2] = { 0, 1 }; /* Reverts to default tables */
2862 resplen = 0;
2863 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EFD_CHScxx . . $ `src/cups/backend_hiti.c:122:9`!, chs, sizeof(chs), &resplen);
2864 if (ret)
2865 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2866 }
2867 }
2868
2869 /* Start Page */
2870 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EPC_SPcxx . . $ `src/cups/backend_hiti.c:127:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, &resplen);
2871 if (ret)
2872 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2873
2874 resend_y:
2875 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Sending yellow plane\n");
2876 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EPC_SYPcxx . . $ `src/cups/backend_hiti.c:129:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, &resplen);
2877 if (ret)
2878 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2879 ret = hiti_sepdcxx . . $ hiti_sepd(a6d8e378a3069b49).(ctx, rows * cols, startLine, numLines);
2880 if (ret)
2881 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2882 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., job->databufcxx . . $ hiti_printjob#databuf. + sent, rows * cols);
2883 if (ret)
2884 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2885 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(200*1000);
2886 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
2887 if (ret)
2888 return ret;
2889 if (err) {
2890 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported alert: %08x (%s)\n",
2891 err, hiti_errors(err));
2892 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2893 }
2894 if (sts[0] & STATUS0_RESEND_DATAcxx . . $ `src/cups/backend_hiti.c:924:9`!) {
2895 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer requested resend\n");
2896 goto resend_y;
2897 }
2898 sent += rows * cols;
2899
2900 resend_m:
2901 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Sending magenta plane\n");
2902 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EPC_SMPcxx . . $ `src/cups/backend_hiti.c:130:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, &resplen);
2903 if (ret)
2904 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2905 ret = hiti_sepdcxx . . $ hiti_sepd(a6d8e378a3069b49).(ctx, rows * cols, startLine, numLines);
2906 if (ret)
2907 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2908 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., job->databufcxx . . $ hiti_printjob#databuf. + sent, rows * cols);
2909 if (ret)
2910 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2911 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(200*1000);
2912 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
2913 if (ret)
2914 return ret;
2915 if (err) {
2916 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported alert: %08x (%s)\n",
2917 err, hiti_errors(err));
2918 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2919 }
2920 if (sts[0] & STATUS0_RESEND_DATAcxx . . $ `src/cups/backend_hiti.c:924:9`!) {
2921 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer requested resend\n");
2922 goto resend_m;
2923 }
2924 sent += rows * cols;
2925
2926 resend_c:
2927 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Sending cyan plane\n");
2928 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EPC_SCPcxx . . $ `src/cups/backend_hiti.c:131:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, &resplen);
2929 if (ret)
2930 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2931 ret = hiti_sepdcxx . . $ hiti_sepd(a6d8e378a3069b49).(ctx, rows * cols, startLine, numLines);
2932 if (ret)
2933 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2934 ret = send_datacxx . . $ send_data(b2b51896d93e30f1).(ctx->conncxx . . $ hiti_ctx#conn., job->databufcxx . . $ hiti_printjob#databuf. + sent, rows * cols);
2935 if (ret)
2936 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2937 __usleepcxx . . $ `src/cups/backend_hiti.c:37:9`!(200*1000);
2938
2939 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
2940 if (ret)
2941 return ret;
2942 if (err) {
2943 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported alert: %08x (%s)\n",
2944 err, hiti_errors(err));
2945 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2946 }
2947 if (sts[0] & STATUS0_RESEND_DATAcxx . . $ `src/cups/backend_hiti.c:924:9`!) {
2948 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Printer requested resend\n");
2949 goto resend_c;
2950 }
2951 sent += rows * cols;
2952
2953 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Sending Print start\n");
2954 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_EPC_EPcxx . . $ `src/cups/backend_hiti.c:128:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, &resplen);
2955 if (ret)
2956 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2957
2958 resplen = 3;
2959 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_JC_EJcxx . . $ `src/cups/backend_hiti.c:97:9`!, (uint8_tcxx . . $ uint8_t#*) &jobid, sizeof(jobid), (uint8_tcxx . . $ uint8_t#*) &jobid, &resplen);
2960 if (ret)
2961 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2962
2963 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Waiting for printer acknowledgement\n");
2964 do {
2965 struct hiti_job_qqacxx . . $ hiti_job_qqa# qqa;
2966 sleepcxx . . $ sleep(2141b656ce2cc063).(1);
2967
2968 ret = hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err);
2969 if (ret)
2970 return ret;
2971
2972 if (err) {
2973 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported alert: %08x (%s)\n",
2974 err, hiti_errors(err));
2975 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2976 }
2977
2978 if (!wait_for_return) {
2979 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Fast return mode enabled.\n");
2980 break;
2981 }
2982
2983 /* See if our job is done.. */
2984 ret = hiti_query_job_qacxx . . $ hiti_query_job_qa(962c75e45e54edc0).(ctx, &jobid, &qqa);
2985 if (ret)
2986 return ret;
2987
2988 /* If our job is complete.. */
2989 if (qqa.countcxx . . $ hiti_job_qqa#count. == 0 || qqa.rowcxx . . $ hiti_job_qqa#row.[0].jobcxx . . $ hiti_job_qqa#$anonymous_type_0#job..jobidcxx . . $ hiti_job#jobid. == 0)
2990 break;
2991
2992 for (int i = 0 ; i < qqa.countcxx . . $ hiti_job_qqa#count. ; i++) {
2993 if (qqa.rowcxx . . $ hiti_job_qqa#row.[i].jobcxx . . $ hiti_job_qqa#$anonymous_type_0#job..jobidcxx . . $ hiti_job#jobid. == jobid.jobidcxx . . $ hiti_job#jobid.) {
2994 if (qqa.rowcxx . . $ hiti_job_qqa#row.[i].statuscxx . . $ hiti_job_qqa#$anonymous_type_0#status. > QQA_STATUS_SUSPENDEDcxx . . $ `src/cups/backend_hiti.c:263:9`!) {
2995 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Printer reported abnormal job status %02x\n", qqa.row[i].status);
2996 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
2997 }
2998 }
2999 }
3000 } while(1);
3001
3002 INFOcxx . . $ `src/cups/backend_common.h:61:9`!("Print complete\n");
3003
3004 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3005 }
3006
3007 static int hiti_dumpmatrixcxx . . $ hiti_dumpmatrix(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3008 {
3009 int ret;
3010
3011 if (ctx->conncxx . . $ hiti_ctx#conn.->typecxx . . $ dyesub_connection#type. == P_HITI_51Xcxx . . $ P_HITI_51X.) {
3012 ret = hiti_query_matrix_51xcxx . . $ hiti_query_matrix_51x(47d69a6bfedd2223).(ctx);
3013 } else {
3014 ret = hiti_query_matrixcxx . . $ hiti_query_matrix(47d69a6bfedd2223).(ctx);
3015 }
3016 if (ret)
3017 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
3018
3019 int i;
3020 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("MAT ");
3021 for (i = 0 ; i < 512 ; i++) {
3022 if (i != 0 && (i % 16 == 0)) {
3023 DEBUG2cxx . . $ `src/cups/backend_common.h:60:9`!("\n");
3024 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!(" ");
3025 }
3026 DEBUG2cxx . . $ `src/cups/backend_common.h:60:9`!("%02x ", ctx->matrix[i]);
3027 }
3028 DEBUG2cxx . . $ `src/cups/backend_common.h:60:9`!("\n");
3029
3030 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3031 }
3032
3033 static int hiti_cmdline_argcxx . . $ hiti_cmdline_arg(bd8af97f5fa850e1).(void *vctx, int argc, char **argv)
3034 {
3035 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
3036 int i, j = 0;
3037
3038 if (!ctx)
3039 return -1;
3040
3041 while ((i = getoptcxx . . $ getopt(2483c31ff9bab884).(argc, argv, GETOPT_LIST_GLOBALcxx . . $ `src/cups/backend_common.h:381:9`! "irRsZ")) >= 0) {
3042 switch(i) {
3043 GETOPT_PROCESS_GLOBALcxx . . $ `src/cups/backend_common.h:382:9`!
3044 case 'i':
3045 hiti_get_infocxx . . $ hiti_get_info(47d69a6bfedd2223).(ctx);
3046 break;
3047 case 'r':
3048 hiti_doresetcxx . . $ hiti_doreset(d63471c3d727dc9).(ctx, RESET_SOFTcxx . . $ `src/cups/backend_hiti.c:187:9`!);
3049 break;
3050 case 'R':
3051 hiti_doresetcxx . . $ hiti_doreset(d63471c3d727dc9).(ctx, RESET_PRINTERcxx . . $ `src/cups/backend_hiti.c:186:9`!);
3052 break;
3053 case 's':
3054 hiti_get_statuscxx . . $ hiti_get_status(47d69a6bfedd2223).(ctx);
3055 break;
3056 case 'Z':
3057 hiti_dumpmatrixcxx . . $ hiti_dumpmatrix(47d69a6bfedd2223).(ctx);
3058 break;
3059 }
3060
3061 if (j) return j;
3062 }
3063
3064 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3065 }
3066
3067 static void hiti_cmdlinecxx . . $ hiti_cmdline(49f6e7a06ebc5aa8).(void)
3068 {
3069 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("\t\t[ -i ] # Query printer information\n");
3070 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("\t\t[ -r ] # Soft Reset printer\n");
3071 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("\t\t[ -R ] # Reset printer\n");
3072 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("\t\t[ -s ] # Query printer status\n");
3073 // DEBUG("\t\t[ -Z ] # Dump matrix table\n");
3074 }
3075
3076 static int hiti_query_versioncxx . . $ hiti_query_version(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3077 {
3078 int ret;
3079 uint16_tcxx . . $ uint16_t# len = 256; /* P525 has 93 byte payload, P461 has 97, others are 79? */
3080 uint8_tcxx . . $ uint8_t# buf[256];
3081
3082 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDC_RScxx . . $ `src/cups/backend_hiti.c:75:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, buf, &len);
3083 if (ret)
3084 return ret;
3085
3086 /* Copy strings */
3087 strncpycxx . . $ strncpy(255158a415b673b0).(ctx->idcxx . . $ hiti_ctx#id., (char*) &buf[34], buf[33]);
3088 strncpycxx . . $ strncpy(255158a415b673b0).(ctx->versioncxx . . $ hiti_ctx#version., (char*) &buf[34 + buf[33] + 1], sizeof(ctx->versioncxx . . $ hiti_ctx#version.));
3089 ctx->versioncxx . . $ hiti_ctx#version.[9] = 0;
3090
3091 /* Early P630 firmware had a trailing newline */
3092 if (ctx->versioncxx . . $ hiti_ctx#version.[8] == '\n')
3093 ctx->versioncxx . . $ hiti_ctx#version.[8] = 0;
3094
3095 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3096 }
3097
3098 static int hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# *sts, uint32_tcxx . . $ uint32_t# *err)
3099 {
3100 int ret;
3101 uint16_tcxx . . $ uint16_t# len = 3;
3102 uint16_tcxx . . $ uint16_t# cmd;
3103
3104 *err = 0;
3105
3106 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDS_RSScxx . . $ `src/cups/backend_hiti.c:84:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, sts, &len);
3107 if (ret)
3108 return ret;
3109
3110 if (sts[2] & STATUS2_WARNINGcxx . . $ `src/cups/backend_hiti.c:929:9`!)
3111 cmd = CMD_RDS_RWcxx . . $ `src/cups/backend_hiti.c:89:9`!;
3112 else if (sts[2] & STATUS2_DEVSERVICEcxx . . $ `src/cups/backend_hiti.c:930:9`!)
3113 cmd = CMD_RDS_DSRAcxx . . $ `src/cups/backend_hiti.c:90:9`!;
3114 else if (sts[2] & STATUS2_OPERATORcxx . . $ `src/cups/backend_hiti.c:931:9`!)
3115 cmd = CMD_RDS_ROIRAcxx . . $ `src/cups/backend_hiti.c:88:9`!;
3116 else if (sts[1] & STATUS1_PAPERJAMcxx . . $ `src/cups/backend_hiti.c:927:9`!)
3117 cmd = CMD_RDS_RJAcxx . . $ `src/cups/backend_hiti.c:87:9`!;
3118 else if (sts[1] & STATUS1_INPUTcxx . . $ `src/cups/backend_hiti.c:928:9`!)
3119 cmd = CMD_RDS_RIAcxx . . $ `src/cups/backend_hiti.c:86:9`!;
3120 else if (sts[1] & STATUS1_SUPPLIEScxx . . $ `src/cups/backend_hiti.c:926:9`!)
3121 cmd = CMD_RDS_SAcxx . . $ `src/cups/backend_hiti.c:91:9`!;
3122 else
3123 cmd = 0;
3124
3125 /* Query extended status, if needed */
3126 if (cmd) {
3127 uint8_tcxx . . $ uint8_t# respbuf[17]; /* Enough for four errors */
3128 len = sizeof(respbuf);
3129
3130 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, cmd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, respbuf, &len);
3131 if (ret)
3132 return ret;
3133
3134 if (!respbuf[0])
3135 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3136
3137 if (respbuf[0] > 1) {
3138 WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!("Multiple Alerts detected, only returning the first!\n");
3139 } else if (len > 8) {
3140 // XXX means we have ASCIIHEX in positions [5:8], convert to number..
3141 // eg "30 31 30 30" == Code 0100
3142 }
3143
3144 memcpycxx . . $ memcpy(cc817cb175f282d).(err, &respbuf[1], sizeof(*err));
3145 *err = be32_to_cpucxx . . $ `src/cups/backend_common.h:70:9`!(*err);
3146 *err >>= 8;
3147 }
3148
3149 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3150 }
3151
3152 static int hiti_query_summarycxx . . $ hiti_query_summary(dae0eb98bf879044).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, struct hiti_erdc_rscxx . . $ hiti_erdc_rs# *rds)
3153 {
3154 int ret;
3155 uint16_tcxx . . $ uint16_t# len = sizeof(*rds);
3156
3157 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RScxx . . $ `src/cups/backend_hiti.c:103:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)rds, &len);
3158 if (ret)
3159 return ret;
3160
3161 rds->stridecxx . . $ hiti_erdc_rs#stride. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->stride);
3162 rds->dpi_colscxx . . $ hiti_erdc_rs#dpi_cols. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->dpi_cols);
3163 rds->dpi_rowscxx . . $ hiti_erdc_rs#dpi_rows. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->dpi_rows);
3164 rds->colscxx . . $ hiti_erdc_rs#cols. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->cols);
3165 rds->rowscxx . . $ hiti_erdc_rs#rows. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->rows);
3166 rds->vertUnitInstalledcxx . . $ hiti_erdc_rs#vertUnitInstalled. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->vertUnitInstalled);
3167 rds->dpi_rows2cxx . . $ hiti_erdc_rs#dpi_rows2. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->dpi_rows2);
3168 rds->dpi_rows3cxx . . $ hiti_erdc_rs#dpi_rows3. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(rds->dpi_rows3);
3169 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3170 }
3171
3172 static int hiti_query_rpidmcxx . . $ hiti_query_rpidm(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3173 {
3174 int ret;
3175 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->rpidmcxx . . $ hiti_ctx#rpidm.);
3176
3177 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RPIDMcxx . . $ `src/cups/backend_hiti.c:110:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)&ctx->rpidmcxx . . $ hiti_ctx#rpidm., &len);
3178 if (ret)
3179 return ret;
3180
3181 ctx->rpidmcxx . . $ hiti_ctx#rpidm..usb_pidcxx . . $ hiti_rpidm#usb_pid. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(ctx->rpidm.usb_pid);
3182
3183 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3184 }
3185
3186 static int hiti_query_hilightadjcxx . . $ hiti_query_hilightadj(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3187 {
3188 int ret;
3189 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->hilight_adjcxx . . $ hiti_ctx#hilight_adj.);
3190
3191 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RHAcxx . . $ `src/cups/backend_hiti.c:118:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, ctx->hilight_adjcxx . . $ hiti_ctx#hilight_adj., &len);
3192 if (ret)
3193 return ret;
3194
3195 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3196 }
3197
3198 static int hiti_query_unk8010cxx . . $ hiti_query_unk8010(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3199 {
3200 int ret;
3201 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->unk_8010cxx . . $ hiti_ctx#unk_8010.);
3202
3203 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_UNK0cxx . . $ `src/cups/backend_hiti.c:116:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, ctx->unk_8010cxx . . $ hiti_ctx#unk_8010., &len);
3204 if (ret)
3205 return ret;
3206
3207 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3208 }
3209
3210 static int hiti_query_unk800ccxx . . $ hiti_query_unk800c(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3211 {
3212 int ret;
3213 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->unk_800ccxx . . $ hiti_ctx#unk_800c.);
3214
3215 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_UNKCcxx . . $ `src/cups/backend_hiti.c:112:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, ctx->unk_800ccxx . . $ hiti_ctx#unk_800c., &len);
3216 if (ret)
3217 return ret;
3218
3219 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3220 }
3221
3222 static int hiti_query_calibrationcxx . . $ hiti_query_calibration(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3223 {
3224 int ret;
3225 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->calibrationcxx . . $ hiti_ctx#calibration.);
3226
3227 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RCCcxx . . $ `src/cups/backend_hiti.c:104:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)&ctx->calibrationcxx . . $ hiti_ctx#calibration., &len);
3228 if (ret)
3229 return ret;
3230
3231 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3232 }
3233
3234 static int hiti_query_led_calibrationcxx . . $ hiti_query_led_calibration(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3235 {
3236 int ret;
3237 uint16_tcxx . . $ uint16_t# len;
3238
3239 if (ctx->sheetcxx . . $ hiti_ctx#sheet.) {
3240 len = sizeof(ctx->led_calibrationcxx . . $ hiti_ctx#led_calibration.) - 4;
3241 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RLCcxx . . $ `src/cups/backend_hiti.c:106:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)(&ctx->led_calibrationcxx . . $ hiti_ctx#led_calibration.)+4, &len);
3242 } else {
3243 len = sizeof(ctx->led_calibrationcxx . . $ hiti_ctx#led_calibration.);
3244 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RLCcxx . . $ `src/cups/backend_hiti.c:106:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)&ctx->led_calibrationcxx . . $ hiti_ctx#led_calibration., &len);
3245 }
3246 if (ret)
3247 return ret;
3248
3249 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3250 }
3251
3252 static int hiti_query_ribbonvendorcxx . . $ hiti_query_ribbonvendor(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3253 {
3254 int ret;
3255 uint16_tcxx . . $ uint16_t# len = 2;
3256
3257 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RRVCcxx . . $ `src/cups/backend_hiti.c:115:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*) &ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor., &len);
3258 if (ret)
3259 return ret;
3260
3261 ctx->ribbonvendorcxx . . $ hiti_ctx#ribbonvendor. = be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(ctx->ribbonvendor);
3262
3263 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3264 }
3265
3266 static int hiti_query_tphvcxx . . $ hiti_query_tphv(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3267 {
3268 int ret;
3269 uint16_tcxx . . $ uint16_t# len = 2;
3270
3271 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RTLVcxx . . $ `src/cups/backend_hiti.c:114:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*) &ctx->rtlvcxx . . $ hiti_ctx#rtlv., &len);
3272 if (ret)
3273 return ret;
3274
3275 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3276 }
3277
3278 static int hiti_query_suppliescxx . . $ hiti_query_supplies(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3279 {
3280 int ret;
3281 uint16_tcxx . . $ uint16_t# len = sizeof(ctx->ribboncxx . . $ hiti_ctx#ribbon.);
3282 uint8_tcxx . . $ uint8_t# arg = 0;
3283
3284 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDS_RSUScxx . . $ `src/cups/backend_hiti.c:93:9`!, &arg, sizeof(arg), (uint8_tcxx . . $ uint8_t#*)&ctx->ribboncxx . . $ hiti_ctx#ribbon., &len);
3285 if (ret)
3286 return ret;
3287
3288 len = sizeof(ctx->papercxx . . $ hiti_ctx#paper.);
3289 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDS_RIScxx . . $ `src/cups/backend_hiti.c:85:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, (uint8_tcxx . . $ uint8_t#*)&ctx->papercxx . . $ hiti_ctx#paper., &len);
3290 if (ret)
3291 return ret;
3292
3293 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3294 }
3295
3296 static int hiti_query_statisticscxx . . $ hiti_query_statistics(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3297 {
3298 int ret;
3299 uint16_tcxx . . $ uint16_t# len = 30;
3300 uint8_tcxx . . $ uint8_t# buf[256];
3301 int i;
3302
3303 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_RDS_RPScxx . . $ `src/cups/backend_hiti.c:92:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, buf, &len);
3304 if (ret)
3305 return ret;
3306
3307 for (i = 0 ; i < buf[0] && i*5+1 < len ; i+= 5) {
3308 /* uint8_t type
3309 uint32_t val
3310 */
3311 if (buf[1 + i*5] == 0x03) { // Remaining prints
3312 memcpycxx . . $ memcpy(cc817cb175f282d).(&ctx->media_remaincxx . . $ hiti_ctx#media_remain., &buf[1 + i*5 + 1], sizeof(ctx->media_remaincxx . . $ hiti_ctx#media_remain.));
3313 ctx->media_remaincxx . . $ hiti_ctx#media_remain. = be32_to_cpucxx . . $ `src/cups/backend_common.h:70:9`!(ctx->media_remain);
3314 }
3315 }
3316
3317 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3318 }
3319
3320 static int hiti_doresetcxx . . $ hiti_doreset(d63471c3d727dc9).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# type)
3321 {
3322 int ret;
3323 uint8_tcxx . . $ uint8_t# buf[6];
3324 uint16_tcxx . . $ uint16_t# len = 6;
3325
3326 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_PCC_RPcxx . . $ `src/cups/backend_hiti.c:79:9`!, &type, sizeof(type), buf, &len);
3327 if (ret)
3328 return ret;
3329
3330 sleepcxx . . $ sleep(2141b656ce2cc063).(5);
3331
3332 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3333 }
3334
3335 static int hiti_query_matrixcxx . . $ hiti_query_matrix(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3336 {
3337 int ret;
3338 int i;
3339 uint16_tcxx . . $ uint16_t# len = 1;
3340
3341 for (i = 0 ; i < 512 ; i++) {
3342 uint16_tcxx . . $ uint16_t# offset = cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`!(i);
3343
3344 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_EFM_RDcxx . . $ `src/cups/backend_hiti.c:163:9`!, (uint8_tcxx . . $ uint8_t#*)&offset, sizeof(offset), &ctx->matrixcxx . . $ hiti_ctx#matrix.[i], &len);
3345 if (ret)
3346 return ret;
3347 }
3348
3349 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3350 }
3351
3352 static int hiti_query_matrix_51xcxx . . $ hiti_query_matrix_51x(47d69a6bfedd2223).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx)
3353 {
3354 int ret;
3355 int i;
3356 uint16_tcxx . . $ uint16_t# len = 1;
3357
3358 uint8_tcxx . . $ uint8_t# lun = 0;
3359 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_PCC_STPcxx . . $ `src/cups/backend_hiti.c:81:9`!, (uint8_tcxx . . $ uint8_t#*)&lun, sizeof(lun), &len);
3360 if (ret)
3361 return ret;
3362
3363 for (i = 0 ; i < 512 ; i++) {
3364 uint8_tcxx . . $ uint8_t# offset = i % 256;
3365 if (offset == 0) {
3366 lun = i / 256;
3367 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_PCC_STPcxx . . $ `src/cups/backend_hiti.c:81:9`!, (uint8_tcxx . . $ uint8_t#*)&lun, sizeof(lun), &len);
3368 if (ret)
3369 return ret;
3370 }
3371 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_EFM_RNVcxx . . $ `src/cups/backend_hiti.c:161:9`!, (uint8_tcxx . . $ uint8_t#*)&offset, sizeof(offset), &ctx->matrixcxx . . $ hiti_ctx#matrix.[i], &len);
3372 if (ret)
3373 return ret;
3374 }
3375
3376 lun = 0;
3377 ret = hiti_docmdcxx . . $ hiti_docmd(c80d22dc699a5681).(ctx, CMD_PCC_STPcxx . . $ `src/cups/backend_hiti.c:81:9`!, (uint8_tcxx . . $ uint8_t#*)&lun, sizeof(lun), &len);
3378 if (ret)
3379 return ret;
3380
3381
3382 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3383 }
3384
3385 static int hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(struct hiti_ctxcxx . . $ hiti_ctx# *ctx, uint8_tcxx . . $ uint8_t# arg, uint32_tcxx . . $ uint32_t# *resp, int num)
3386 {
3387 int ret;
3388 uint16_tcxx . . $ uint16_t# len = sizeof(*resp) * num;
3389
3390 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(ctx, CMD_ERDC_RPCcxx . . $ `src/cups/backend_hiti.c:105:9`!, &arg, sizeof(arg),
3391 (uint8_tcxx . . $ uint8_t#*) resp, &len);
3392 if (ret)
3393 return ret;
3394
3395 *resp = be32_to_cpucxx . . $ `src/cups/backend_common.h:70:9`!(*resp);
3396
3397 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3398 }
3399
3400 static int hiti_query_sernocxx . . $ hiti_query_serno(a3ebabf18f8093e8).(struct dyesub_connectioncxx . . $ dyesub_connection# *conn, char *buf, int buf_len)
3401 {
3402 int ret;
3403 uint16_tcxx . . $ uint16_t# rsplen = 18;
3404 uint8_tcxx . . $ uint8_t# rspbuf[18];
3405
3406 struct hiti_ctxcxx . . $ hiti_ctx# ctx = {
3407 .conn = conn
3408 };
3409
3410 uint8_tcxx . . $ uint8_t# arg = sizeof(rspbuf);
3411 ret = hiti_docmd_respcxx . . $ hiti_docmd_resp(f47ab3428b3ebf08).(&ctx, CMD_ERDC_RSNcxx . . $ `src/cups/backend_hiti.c:107:9`!, &arg, sizeof(arg), rspbuf, &rsplen);
3412 if (ret)
3413 return ret;
3414
3415 /* Copy over serial number */
3416 strncpycxx . . $ strncpy(255158a415b673b0).(buf, (char*)rspbuf, buf_len);
3417
3418 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3419 }
3420
3421 static int hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).(void *vctx, struct markercxx . . $ marker# **markers, int *count)
3422 {
3423 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
3424 int ret;
3425
3426 if (markers)
3427 *markers = &ctx->markercxx . . $ hiti_ctx#marker.;
3428 if (count)
3429 *count = 1;
3430
3431 ret = hiti_query_statisticscxx . . $ hiti_query_statistics(47d69a6bfedd2223).(ctx);
3432 if (ret)
3433 return ret;
3434
3435 if (ctx->sheetcxx . . $ hiti_ctx#sheet.) {
3436 ctx->markercxx . . $ hiti_ctx#marker..levelnowcxx . . $ marker#levelnow. = CUPS_MARKER_UNKNOWN_OKcxx . . $ `src/cups/backend_common.h:378:9`!;
3437 // XXX alter this, check for errors and return 0 instead.
3438 } else {
3439 ctx->markercxx . . $ hiti_ctx#marker..levelnowcxx . . $ marker#levelnow. = ctx->media_remaincxx . . $ hiti_ctx#media_remain.;
3440 }
3441
3442 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3443 }
3444
3445 static int hiti_query_statscxx . . $ hiti_query_stats(845d5d60c7643b8).(void *vctx, struct printerstatscxx . . $ printerstats# *stats)
3446 {
3447 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
3448 uint8_tcxx . . $ uint8_t# sts[3];
3449 uint32_tcxx . . $ uint32_t# err = 0;
3450 uint32_tcxx . . $ uint32_t# tmp[2] = {0, 0}; /* Second only used for P51x */
3451
3452 /* Update marker info */
3453 if (hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!))
3454 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
3455 if (hiti_query_statuscxx . . $ hiti_query_status(34a4d82ebd93e5e4).(ctx, sts, &err))
3456 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
3457
3458 stats->mfgcxx . . $ printerstats#mfg. = "HiTi";
3459 stats->modelcxx . . $ printerstats#model. = ctx->idcxx . . $ hiti_ctx#id.;
3460 stats->serialcxx . . $ printerstats#serial. = ctx->sernocxx . . $ hiti_ctx#serno.;
3461 stats->fwvercxx . . $ printerstats#fwver. = ctx->versioncxx . . $ hiti_ctx#version.;
3462
3463 stats->deckscxx . . $ printerstats#decks. = 1;
3464 stats->mediatypecxx . . $ printerstats#mediatype.[0] = ctx->markercxx . . $ hiti_ctx#marker..namecxx . . $ marker#name.;
3465 stats->levelmaxcxx . . $ printerstats#levelmax.[0] = ctx->markercxx . . $ hiti_ctx#marker..levelmaxcxx . . $ marker#levelmax.;
3466 stats->levelnowcxx . . $ printerstats#levelnow.[0] = ctx->markercxx . . $ hiti_ctx#marker..levelnowcxx . . $ marker#levelnow.;
3467 stats->namecxx . . $ printerstats#name.[0] = "Roll";
3468 stats->cnt_lifecxx . . $ printerstats#cnt_life.[0] = 0;
3469
3470 if (hiti_query_countercxx . . $ hiti_query_counter(b83449cb6f60f7e0).(ctx, 1, tmp, ctx->erdc_rpc_lencxx . . $ hiti_ctx#erdc_rpc_len.))
3471 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
3472
3473 stats->cnt_lifecxx . . $ printerstats#cnt_life.[0] += tmp[0];
3474
3475 if (err)
3476 stats->statuscxx . . $ printerstats#status.[0] = strdupcxx . . $ strdup(a8b8e32347182212).(hiti_errorscxx . . $ hiti_errors(81a3ae90da26a711).(err));
3477 else
3478 stats->statuscxx . . $ printerstats#status.[0] = strdupcxx . . $ strdup(a8b8e32347182212).(hiti_statuscxx . . $ hiti_status(366f986dcc4a6ef).(sts));
3479
3480 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3481 }
3482
3483 static void *hiti_find_heattable_v2_entrycxx . . $ hiti_find_heattable_v2_entry(816ea6d80e1ec686).(const struct hiti_printjobcxx . . $ hiti_printjob# *job, int id, size_t *len)
3484 {
3485 int i;
3486 for (i = 0; i < job->num_heattable_entriescxx . . $ hiti_printjob#num_heattable_entries. ; i++) {
3487 if (job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].typecxx . . $ hiti_heattable_v2#type. == id) {
3488 *len = job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].lencxx . . $ hiti_heattable_v2#len.;
3489 return job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].datacxx . . $ hiti_heattable_v2#data.;
3490 }
3491 }
3492 *len = 0;
3493 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3494 }
3495
3496 static int hiti_parse_heattable_v2cxx . . $ hiti_parse_heattable_v2(6171dc793ae4f88a).(struct hiti_printjobcxx . . $ hiti_printjob# *job) {
3497 int i;
3498 struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# *hdr;
3499 uint32_tcxx . . $ uint32_t# base = 0;
3500 uint8_tcxx . . $ uint8_t# match = 0x00; /* Or 0x20 when there's more than one? */
3501
3502 restart:
3503 hdr = (struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# *) job->heattable_bufcxx . . $ hiti_printjob#heattable_buf.;
3504 job->heattable_v2cxx . . $ hiti_printjob#heattable_v2. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(hdr->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers. * sizeof(struct hiti_heattable_v2cxx . . $ hiti_heattable_v2#));
3505 if (!job->heattable_bufcxx . . $ hiti_printjob#heattable_buf.) {
3506 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failed!\n");
3507 return CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`!;
3508 }
3509
3510 job->num_heattable_entriescxx . . $ hiti_printjob#num_heattable_entries. = hdr->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers.;
3511
3512 for (i = 0 ; i < hdr->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers. ; i++) {
3513 job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].typecxx . . $ hiti_heattable_v2#type. = hdr->entriescxx . . $ hiti_heattable_hdr_v2#entries.[i].typecxx . . $ hiti_heattable_entry_v2#type.;
3514 job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].datacxx . . $ hiti_heattable_v2#data. = job->heattable_bufcxx . . $ hiti_printjob#heattable_buf. + base + le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(hdr->entries[i].offset);
3515 job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.[i].lencxx . . $ hiti_heattable_v2#len. = le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(hdr->entries[i].len) * 2;
3516
3517 if (dyesub_debugcxx . . $ dyesub_debug.)
3518 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Heattable entry: %02x len %d @ %d\n",
3519 job->heattable_v2[i].type,
3520 job->heattable_v2[i].len,
3521 le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(hdr->entries[i].offset));
3522
3523 if (hdr->entriescxx . . $ hiti_heattable_hdr_v2#entries.[i].typecxx . . $ hiti_heattable_entry_v2#type. == match) {
3524 if (dyesub_debugcxx . . $ dyesub_debug.)
3525 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Found embedded table type %0x02\n", match);
3526 base = le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(hdr->entries[i].offset);
3527 freecxx . . $ free(5d22bdacc48458e8).(job->heattable_v2cxx . . $ hiti_printjob#heattable_v2.);
3528 goto restart;
3529 }
3530 }
3531
3532 return CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`!;
3533 };
3534
3535 #define APPEND_ENTRYcxx . . $ `src/cups/backend_hiti.c:3535:9`!(__type) do { \
3536 data = hiti_find_heattable_v2_entry(job, __type, &len); \
3537 if (data) { \
3538 table->entries[table->num_headers++].type = __type; \
3539 } \
3540 } while(0)
3541
3542 #define APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(__type) do { \
3543 data = hiti_find_heattable_v2_entry(job, __type, &len); \
3544 if (data) { \
3545 table->entries[table->num_headers++].type = __type; \
3546 } else { \
3547 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Missing required HEATv2 entry %02x\n", __type); \
3548 goto fail; \
3549 } \
3550 } while(0)
3551
3552 #define APPEND_ENTRY_FAIL2cxx . . $ `src/cups/backend_hiti.c:3552:9`!(__type, __type2) do { \
3553 data = hiti_find_heattable_v2_entry(job, __type, &len); \
3554 if (data) { \
3555 table->entries[table->num_headers++].type = __type; \
3556 } else { \
3557 data = hiti_find_heattable_v2_entry(job, __type2, &len); \
3558 if (data) { \
3559 table->entries[table->num_headers++].type = __type2; \
3560 } else { \
3561 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Missing required HEATv2 entry %02x/%02x\n", __type,__type2); \
3562 goto fail; \
3563 } \
3564 } \
3565 } while(0)
3566
3567 #define APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(__type, __type2, __var2) do { \
3568 data = hiti_find_heattable_v2_entry(job, __type, &len); \
3569 if (data) { \
3570 table->entries[table->num_headers++].type = __type; \
3571 } else if (!__var2) { \
3572 data = hiti_find_heattable_v2_entry(job, __type2, &len); \
3573 if (data) { \
3574 table->entries[table->num_headers++].type = __type2; \
3575 __var2 = 1; \
3576 } \
3577 } \
3578 } while(0)
3579
3580 #define APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(__type, __type2, __var2, __type3, __var3) do { \
3581 data = hiti_find_heattable_v2_entry(job, __type, &len); \
3582 if (data) { \
3583 table->entries[table->num_headers++].type = __type; \
3584 } else if (!__var2) { \
3585 data = hiti_find_heattable_v2_entry(job, __type2, &len); \
3586 if (data) { \
3587 table->entries[table->num_headers++].type = __type2; \
3588 __var2 = 1; \
3589 } else if (!__var3) { \
3590 data = hiti_find_heattable_v2_entry(job, __type3, &len); \
3591 if (data) { \
3592 table->entries[table->num_headers++].type = __type3; \
3593 __var3 = 1; \
3594 } \
3595 } \
3596 } \
3597 } while(0)
3598
3599 static int hiti_construct_heattable_v2cxx . . $ hiti_construct_heattable_v2(6f0ee2c8f7bc776c).(const struct hiti_printjobcxx . . $ hiti_printjob# *job, int planes, int colormode, struct hiti_heattable_hdr_v2cxx . . $ hiti_heattable_hdr_v2# *table)
3600 {
3601 size_t len;
3602 void *data;
3603
3604 int hac_ymc = 0, hac_all = 0;
3605 int ls_ymc = 0, ls_all = 0;
3606 int gl_ymc = 0, gl_all = 0;
3607 int en_ymc = 0, en_all = 0;
3608
3609 table->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers. = 0;
3610
3611 /* Version is required */
3612 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_VER_MAJORcxx . . $ `src/cups/backend_hiti.c:353:9`!);
3613 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_VER_MINORcxx . . $ `src/cups/backend_hiti.c:354:9`!);
3614
3615 if (planes & HT_PLANE_Ycxx . . $ HT_PLANE_Y.) {
3616 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_D_Ycxx . . $ `src/cups/backend_hiti.c:341:9`!);
3617 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_Ycxx . . $ `src/cups/backend_hiti.c:359:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3618 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_Ycxx . . $ `src/cups/backend_hiti.c:370:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3619 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_Ycxx . . $ `src/cups/backend_hiti.c:381:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3620 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_Ycxx . . $ `src/cups/backend_hiti.c:392:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3621 }
3622 if (planes & HT_PLANE_Mcxx . . $ HT_PLANE_M.) {
3623 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_D_Mcxx . . $ `src/cups/backend_hiti.c:342:9`!);
3624 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_Mcxx . . $ `src/cups/backend_hiti.c:360:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3625 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_Mcxx . . $ `src/cups/backend_hiti.c:371:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3626 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_Mcxx . . $ `src/cups/backend_hiti.c:382:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3627 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_Mcxx . . $ `src/cups/backend_hiti.c:393:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3628 }
3629 if (planes & HT_PLANE_Ccxx . . $ HT_PLANE_C.) {
3630 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_D_Ccxx . . $ `src/cups/backend_hiti.c:343:9`!);
3631 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_Ccxx . . $ `src/cups/backend_hiti.c:361:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3632 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_Ccxx . . $ `src/cups/backend_hiti.c:372:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3633 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_Ccxx . . $ `src/cups/backend_hiti.c:383:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3634 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_Ccxx . . $ `src/cups/backend_hiti.c:394:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3635 }
3636 if (planes & HT_PLANE_Kcxx . . $ HT_PLANE_K.) {
3637 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_D_Kcxx . . $ `src/cups/backend_hiti.c:344:9`!);
3638 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_DKcxx . . $ `src/cups/backend_hiti.c:362:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3639 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_DKcxx . . $ `src/cups/backend_hiti.c:373:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3640 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_DKcxx . . $ `src/cups/backend_hiti.c:384:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3641 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_DKcxx . . $ `src/cups/backend_hiti.c:395:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3642 }
3643
3644 if (planes & HT_PLANE_RKcxx . . $ HT_PLANE_RK.) {
3645 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_R_RKcxx . . $ `src/cups/backend_hiti.c:345:9`!);
3646 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_RKcxx . . $ `src/cups/backend_hiti.c:363:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3647 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_RKcxx . . $ `src/cups/backend_hiti.c:374:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3648 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_RKcxx . . $ `src/cups/backend_hiti.c:385:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3649 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_RKcxx . . $ `src/cups/backend_hiti.c:396:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3650 } else if (planes & HT_PLANE_Rcxx . . $ HT_PLANE_R.) {
3651 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_R_Rcxx . . $ `src/cups/backend_hiti.c:346:9`!);
3652 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_HAC_Rcxx . . $ `src/cups/backend_hiti.c:364:9`!, HEATTABLE_V2_ID_HAC_YMCcxx . . $ `src/cups/backend_hiti.c:368:9`!, hac_ymc, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3653 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_LS_Rcxx . . $ `src/cups/backend_hiti.c:375:9`!, HEATTABLE_V2_ID_LS_YMCcxx . . $ `src/cups/backend_hiti.c:379:9`!, ls_ymc, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3654 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_GL_Rcxx . . $ `src/cups/backend_hiti.c:386:9`!, HEATTABLE_V2_ID_GL_YMCcxx . . $ `src/cups/backend_hiti.c:390:9`!, gl_ymc, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3655 APPEND_ENTRY_FALLBACK3cxx . . $ `src/cups/backend_hiti.c:3580:9`!(HEATTABLE_V2_ID_EN_Rcxx . . $ `src/cups/backend_hiti.c:397:9`!, HEATTABLE_V2_ID_EN_YMCcxx . . $ `src/cups/backend_hiti.c:401:9`!, en_ymc, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3656 }
3657
3658 if (planes & HT_PLANE_OGcxx . . $ HT_PLANE_OG.) {
3659 APPEND_ENTRY_FAIL2cxx . . $ `src/cups/backend_hiti.c:3552:9`!(HEATTABLE_V2_ID_HT_D_Ocxx . . $ `src/cups/backend_hiti.c:349:9`!, HEATTABLE_V2_ID_HT_D_KOcxx . . $ `src/cups/backend_hiti.c:350:9`!);
3660 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_HAC_Ocxx . . $ `src/cups/backend_hiti.c:365:9`!, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3661 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_LS_Ocxx . . $ `src/cups/backend_hiti.c:376:9`!, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3662 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_GL_Ocxx . . $ `src/cups/backend_hiti.c:387:9`!, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3663 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_EN_Ocxx . . $ `src/cups/backend_hiti.c:398:9`!, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3664 } else if (planes & HT_PLANE_OKcxx . . $ HT_PLANE_OK.) {
3665 APPEND_ENTRY_FAIL2cxx . . $ `src/cups/backend_hiti.c:3552:9`!(HEATTABLE_V2_ID_HT_D_KOcxx . . $ `src/cups/backend_hiti.c:350:9`!, HEATTABLE_V2_ID_HT_D_Ocxx . . $ `src/cups/backend_hiti.c:349:9`!);
3666 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_HAC_Ocxx . . $ `src/cups/backend_hiti.c:365:9`!, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3667 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_LS_Ocxx . . $ `src/cups/backend_hiti.c:376:9`!, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3668 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_GL_Ocxx . . $ `src/cups/backend_hiti.c:387:9`!, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3669 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_EN_Ocxx . . $ `src/cups/backend_hiti.c:398:9`!, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3670 } else if (planes & HT_PLANE_OMcxx . . $ HT_PLANE_OM.) {
3671 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_D_MOcxx . . $ `src/cups/backend_hiti.c:351:9`!);
3672 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_HAC_MOcxx . . $ `src/cups/backend_hiti.c:366:9`!, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3673 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_LS_MOcxx . . $ `src/cups/backend_hiti.c:377:9`!, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3674 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_GL_MOcxx . . $ `src/cups/backend_hiti.c:388:9`!, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3675 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_EN_MOcxx . . $ `src/cups/backend_hiti.c:399:9`!, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3676 }
3677 if (planes & HT_PLANE_FOcxx . . $ HT_PLANE_FO.) {
3678 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_R_FOcxx . . $ `src/cups/backend_hiti.c:348:9`!);
3679 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_HAC_FOcxx . . $ `src/cups/backend_hiti.c:367:9`!, HEATTABLE_V2_ID_HAC_ALLcxx . . $ `src/cups/backend_hiti.c:369:9`!, hac_all);
3680 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_LS_FOcxx . . $ `src/cups/backend_hiti.c:378:9`!, HEATTABLE_V2_ID_LS_ALLcxx . . $ `src/cups/backend_hiti.c:380:9`!, ls_all);
3681 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_GL_FOcxx . . $ `src/cups/backend_hiti.c:389:9`!, HEATTABLE_V2_ID_GL_ALLcxx . . $ `src/cups/backend_hiti.c:391:9`!, gl_all);
3682 APPEND_ENTRY_FALLBACK2cxx . . $ `src/cups/backend_hiti.c:3567:9`!(HEATTABLE_V2_ID_EN_FOcxx . . $ `src/cups/backend_hiti.c:400:9`!, HEATTABLE_V2_ID_EN_ALLcxx . . $ `src/cups/backend_hiti.c:402:9`!, en_all);
3683 }
3684 if (planes & HT_PLANE_Lcxx . . $ HT_PLANE_L.) {
3685 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_HT_R_Lcxx . . $ `src/cups/backend_hiti.c:347:9`!);
3686 }
3687
3688 if (planes & HT_CVDcxx . . $ HT_CVD.) {
3689 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_CVDcxx . . $ `src/cups/backend_hiti.c:352:9`!);
3690 }
3691
3692 if (colormode == HT_COLORMODE_CLASSICcxx . . $ HT_COLORMODE_CLASSIC.) {
3693 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_CT_CLASSICcxx . . $ `src/cups/backend_hiti.c:356:9`!);
3694 } else if (colormode == HT_COLORMODE_IDPASS_VIVIDcxx . . $ HT_COLORMODE_IDPASS_VIVID.) {
3695 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_CT_IDPASScxx . . $ `src/cups/backend_hiti.c:357:9`!);
3696 } else {
3697 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_CT_INVERTcxx . . $ `src/cups/backend_hiti.c:355:9`!);
3698 }
3699
3700 APPEND_ENTRYcxx . . $ `src/cups/backend_hiti.c:3535:9`!(HEATTABLE_V2_ID_TC_COMPENSATEcxx . . $ `src/cups/backend_hiti.c:358:9`!);
3701
3702 if (planes & HT_PLANE_630Xcxx . . $ HT_PLANE_630X.) {
3703 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_OP1cxx . . $ `src/cups/backend_hiti.c:403:9`!);
3704 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_OP2cxx . . $ `src/cups/backend_hiti.c:404:9`!);
3705 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_SMEARcxx . . $ `src/cups/backend_hiti.c:405:9`!);
3706 APPEND_ENTRY_FAILcxx . . $ `src/cups/backend_hiti.c:3542:9`!(HEATTABLE_V2_ID_MSKL_RATEcxx . . $ `src/cups/backend_hiti.c:406:9`!);
3707 }
3708
3709 return 0;
3710
3711 fail:
3712 table->num_headerscxx . . $ hiti_heattable_hdr_v2#num_headers. = 0;
3713 return 1;
3714 }
3715
3716 static void hiti_teardowncxx . . $ hiti_teardown(5d22bdacc48458e8).(void *vctx) {
3717 struct hiti_ctxcxx . . $ hiti_ctx# *ctx = vctx;
3718 freecxx . . $ free(5d22bdacc48458e8).(ctx);
3719 }
3720
3721 #define JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(__x) if (job1->__x != job2->__x) goto done
3722
3723 static void *hiti_combine_jobscxx . . $ hiti_combine_jobs(8025cfb681d2d601).(const void *vjob1,
3724 const void *vjob2)
3725 {
3726 const struct hiti_printjobcxx . . $ hiti_printjob# *job1 = vjob1;
3727 const struct hiti_printjobcxx . . $ hiti_printjob# *job2 = vjob2;
3728 struct hiti_printjobcxx . . $ hiti_printjob# *newjob = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3729 uint16_tcxx . . $ uint16_t# newrows;
3730 int32_tcxx . . $ int32_t# newpad;
3731 uint16_tcxx . . $ uint16_t# newmode;
3732
3733 if (!job1 || !job2)
3734 goto done;
3735
3736 /* Make sure the two jobs can be combined */
3737 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(colormode);
3738 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.cols);
3739 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.rows);
3740 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.quality);
3741 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.code);
3742 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.overcoat);
3743 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.payload_flag);
3744 JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!(hdr.payload_len);
3745
3746 if (job1->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. == 1844 && job1->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. == 1072) {
3747 /* 2x 3.5x5" -> 1x 5x7-div2 */
3748 newrows = 2152;
3749 newpad = 8;
3750 newmode = PRINT_TYPE_5x7_2UPcxx . . $ `src/cups/backend_hiti.c:300:9`!;
3751 } else if (job1->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. == 1844 && job1->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. == 1240) {
3752 /* 2x 4x6 -> 1x 8x6-div2 */
3753 newrows = 2492;
3754 newpad = 12;
3755 newmode = PRINT_TYPE_6x9_2UPcxx . . $ `src/cups/backend_hiti.c:296:9`!;
3756 } else if (job1->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. == 1844 && job1->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. == 1248) {
3757 /* 2x 4x6-div2 -> 1x 8x6-div4 */
3758 /* 2x 4x6-div3 -> 1x 8x6-div6 */
3759 newrows = 2492;
3760 newpad = -4; // XXX better handle this?
3761 if (job1->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. == PRINT_TYPE_6x4_3UPcxx . . $ `src/cups/backend_hiti.c:301:9`!)
3762 newmode = PRINT_TYPE_6x9_6UPcxx . . $ `src/cups/backend_hiti.c:303:9`!;
3763 else
3764 newmode = PRINT_TYPE_6x9_4UPcxx . . $ `src/cups/backend_hiti.c:302:9`!;
3765 } else {
3766 goto done;
3767 }
3768
3769 newpad *= job1->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols.;
3770
3771 /* At this point it's kosher to proceed */
3772
3773 DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!("Combining jobs to save media\n");
3774
3775 /* Allocate new job, duplicate job1's parameters */
3776 newjob = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*newjob));
3777 if (!newjob) {
3778 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failure!\n");
3779 goto done;
3780 }
3781 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob, job1, sizeof(*newjob));
3782
3783 newjob->heattable_bufcxx . . $ hiti_printjob#heattable_buf. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(job1->heattable_lencxx . . $ hiti_printjob#heattable_len.);
3784 if (!newjob->heattable_bufcxx . . $ hiti_printjob#heattable_buf.) {
3785 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failure!\n");
3786 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(newjob);
3787 newjob = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3788 goto done;
3789 }
3790 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->heattable_bufcxx . . $ hiti_printjob#heattable_buf., job1->heattable_bufcxx . . $ hiti_printjob#heattable_buf., job1->heattable_lencxx . . $ hiti_printjob#heattable_len.);
3791
3792 /* Set up new job, where it differs */
3793 newjob->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. = newrows;
3794 newjob->hdrcxx . . $ hiti_printjob#hdr..codecxx . . $ hiti_gpjobhdr#code. = newmode;
3795 newjob->datalencxx . . $ hiti_printjob#datalen. = 0;
3796 newjob->databufcxx . . $ hiti_printjob#databuf. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(newjob->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. * newjob->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols. * 3);
3797
3798 if (!newjob->databufcxx . . $ hiti_printjob#databuf.) {
3799 ERRORcxx . . $ `src/cups/backend_common.h:63:9`!("Memory allocation failed!\n");
3800 hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).(newjob);
3801 newjob = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3802 goto done;
3803 }
3804
3805 uint32_tcxx . . $ uint32_t# planelen = job1->hdrcxx . . $ hiti_printjob#hdr..rowscxx . . $ hiti_gpjobhdr#rows. * job1->hdrcxx . . $ hiti_printjob#hdr..colscxx . . $ hiti_gpjobhdr#cols.;
3806
3807 /* Copy over Y planes */
3808 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job1->databufcxx . . $ hiti_printjob#databuf., planelen);
3809 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3810 if (newpad > 0)
3811 memsetcxx . . $ memset(d1de1e4fb215f1c6).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., 0, newpad);
3812 newjob->datalencxx . . $ hiti_printjob#datalen. += newpad;
3813 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job2->databufcxx . . $ hiti_printjob#databuf., planelen);
3814 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3815
3816 /* Copy over M planes */
3817 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job1->databufcxx . . $ hiti_printjob#databuf. + planelen, planelen);
3818 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3819 if (newpad > 0)
3820 memsetcxx . . $ memset(d1de1e4fb215f1c6).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., 0, newpad);
3821 newjob->datalencxx . . $ hiti_printjob#datalen. += newpad;
3822 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job2->databufcxx . . $ hiti_printjob#databuf. + planelen, planelen);
3823 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3824
3825 /* Copy over C planes */
3826 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job1->databufcxx . . $ hiti_printjob#databuf. + planelen + planelen, planelen);
3827 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3828 if (newpad > 0)
3829 memsetcxx . . $ memset(d1de1e4fb215f1c6).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., 0, newpad);
3830 newjob->datalencxx . . $ hiti_printjob#datalen. += newpad;
3831 memcpycxx . . $ memcpy(cc817cb175f282d).(newjob->databufcxx . . $ hiti_printjob#databuf. + newjob->datalencxx . . $ hiti_printjob#datalen., job2->databufcxx . . $ hiti_printjob#databuf. + planelen + planelen, planelen);
3832 newjob->datalencxx . . $ hiti_printjob#datalen. += planelen;
3833
3834 /* All done */
3835
3836 done:
3837 return newjob;
3838 }
3839
3840 #undef JOB_EQUIVcxx . . $ `src/cups/backend_hiti.c:3721:9`!
3841
3842 static const char *hiti_prefixescxx . . $ hiti_prefixes.[] = {
3843 "hiti", // Family name
3844 "hiti-p52x", /* Just in case */
3845 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!
3846 };
3847
3848 static const struct device_idcxx . . $ device_id# hiti_devicescxx . . $ hiti_devices.[] = {
3849 { 0x0d16, 0x0309, P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-cs200e"},
3850 { 0x0d16, 0x030a, P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-cs220e"},
3851 { 0x0d16, 0x030b, P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-cs230e"},
3852 { 0x0d16, 0x030c, P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-cs250e"},
3853 { 0x0d16, 0x030d, P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-cs290e"},
3854 { 0x0d16, 0x0007, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p510k"},
3855 { 0x0d16, 0x000b, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p510l"},
3856 { 0x0d16, 0x000d, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p518a"},
3857 { 0x0d16, 0x010e, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p510s"},
3858 { 0x0d16, 0x0111, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p510si"},
3859 { 0x0d16, 0x0112, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p518s"},
3860 { 0x0d16, 0x0502, P_HITI_520cxx . . $ P_HITI_520., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p520l"},
3861 { 0x0d16, 0x0503, P_HITI_310cxx . . $ P_HITI_310., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p310l"},
3862 { 0x0d16, 0x050a, P_HITI_310cxx . . $ P_HITI_310., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p310w"},
3863 { 0x0d16, 0x050c, P_HITI_320cxx . . $ P_HITI_320., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p320w"},
•3864 { 0x0d16, 0x050a, P_HITI_310cxx . . $ P_HITI_310., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p322w"}, /* Duplicate */
3865 { 0x0d16, 0x0509, P_HITI_461cxx . . $ P_HITI_461., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p461"},
3866 { 0x0d16, 0x050e, P_HITI_525cxx . . $ P_HITI_525., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p525l"},
3867 { 0x0d16, 0x000f, P_HITI_530cxx . . $ P_HITI_530., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p530d"},
3868 { 0x0d16, 0x0009, P_HITI_720cxx . . $ P_HITI_720., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p720l"},
3869 { 0x0d16, 0x000a, P_HITI_720cxx . . $ P_HITI_720., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p728l"},
3870 { 0x0d16, 0x0501, P_HITI_750cxx . . $ P_HITI_750., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p750l"},
3871 { 0x0d16, 0x0510, P_HITI_826cxx . . $ P_HITI_826., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "joyspace-u826"}, /* OEM variant of P525 */
3872 { 0x0d16, 0x0511, P_HITI_630cxx . . $ P_HITI_630., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p630"},
•3873 { 0x0d16, 0x0511, P_HITI_630cxx . . $ P_HITI_630., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "hiti-p630a"}, /* Duplicate */
3874 // { 0x0d16, XXXXX, P_HITI_630, NULL, "hiti-p630c"}, // placeholder
3875 { 0x0d16, 0x0512, P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "swiftfoto-ksf10r"}, /* OEM variant of P525 */
3876 { 0x0d16, 0xc000, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "yashica-yp120"},
3877 { 0x0d16, 0xd000, P_HITI_51Xcxx . . $ P_HITI_51X., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "touchtunes-p510tt"},
3878 { 0, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!}
3879 /*
3880 #define USB_PID_HITI_P110S 0x0110
3881 #define USB_PID_HITI_X610 0x0800
3882 */
3883
3884 };
3885
3886 const struct dyesub_backendcxx . . $ dyesub_backend# hiti_backendcxx . . $ hiti_backend. = {
3887 .name = "HiTi Photo Printers",
•3888 .version = "0.97",
3889 .uri_prefixes = hiti_prefixescxx . . $ hiti_prefixes.,
3890 .cmdline_usage = hiti_cmdlinecxx . . $ hiti_cmdline(49f6e7a06ebc5aa8).,
3891 .cmdline_arg = hiti_cmdline_argcxx . . $ hiti_cmdline_arg(bd8af97f5fa850e1).,
3892 .init = hiti_initcxx . . $ hiti_init(50c7df7de5344ebb).,
3893 .teardown = hiti_teardowncxx . . $ hiti_teardown(5d22bdacc48458e8).,
3894 .attach = hiti_attachcxx . . $ hiti_attach(65a6cf861cd15f84).,
3895 .cleanup_job = hiti_cleanup_jobcxx . . $ hiti_cleanup_job(e4289f82fef2c2f9).,
3896 .read_parse = hiti_read_parsecxx . . $ hiti_read_parse(296a7ce9eef68a26).,
3897 .main_loop = hiti_main_loopcxx . . $ hiti_main_loop(91e54fd90adbb21).,
3898 .query_serno = hiti_query_sernocxx . . $ hiti_query_serno(a3ebabf18f8093e8).,
3899 .query_markers = hiti_query_markerscxx . . $ hiti_query_markers(5f0c51117cc67eb5).,
3900 .query_stats = hiti_query_statscxx . . $ hiti_query_stats(845d5d60c7643b8).,
3901 .combine_jobs = hiti_combine_jobscxx . . $ hiti_combine_jobs(8025cfb681d2d601).,
3902 .devices = hiti_devicescxx . . $ hiti_devices.,
3903 };
3904
3905 /* TODO:
3906
3907 - Figure out 5x5 prints
3908 - Confirm 6x2" print dimensions (windows?)
3909 - Job control (QJC, RSJ) -- and canceling?
3910 - Set highlight adjustment & H/V alignment from cmdline
3911 * Figure out how to set H/V alignment!
3912 - Figure out if driver needs to consume highlight adjustment
3913 * Feed into gamma correction?
3914 * Feed [un]modified into some printer cmd?
3915 - Figure out Windows spool format (probably never)
3916 - GP Spool parsing improvements
3917 * Add additional 'reserved' fields for future use?
3918 - Further performance optimizations in LUT color conversion code
3919 * Rework to take advantage of auto-vectorization?
3920 * Pre-compute then cache entire map on disk?
3921 * Use external "Cube LUT" implementation?
3922 - Commands UNK_8008, UNK_8010, UNK_800C, ESD_SEHT, CMD_EDM_*
3923 - Test with P720, P750
3924 - Incorporate changes for CS-series card printers
3925 - More "Matrix table" decoding work
3926 - More work on other "sheet type" models
3927 - P110S ("P4x6" 1248x1836)
3928 - P320 series ("P4x6" 1280*1818)
3929 - Others?
3930 - More work on remaining "roll type" models
3931 - P530D
3932 - X610
3933 - Others?
3934 - More work on P461 Prinhome
3935 - Quality mode
3936 - Figure out when to use Heat tables with 'p' quality tags
3937 - Figure out how to send over the "raw" matte overcoat data. (Partial matte is now possible on P52x/P630?)
3938 - P630 Quality analysis on YMC planar data
3939 */