PrintFxv2

This commit is contained in:
2026-09-16 11:29:52 +10:00
parent 922ce99d25
commit 3b2a399769
7 changed files with 57 additions and 11 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ for (const [label, description] of CANDIDATES) {
'--backend', 'network',
'--model', site.printer_model || 'QL-820NWB',
'--printer', target,
'print', '--label', label, file,
'print', '--label', label, ...(label === '62red' ? ['--red'] : []), file,
],
{ stdio: ['ignore', 'pipe', 'pipe'], timeout: config.printing.timeoutMs }
);
+3 -1
View File
@@ -73,8 +73,10 @@ const args = [
'--printer', target,
'print',
'--label', label,
file,
];
// Required on black/red tape even when the badge is entirely black.
if (label === '62red') args.push('--red');
args.push(file);
console.log('');
console.log(` running: ${config.printing.command} ${args.join(' ')}`);
+23 -2
View File
@@ -102,6 +102,15 @@ socket.on('connect', () => {
socket.write(Buffer.alloc(200, 0x00));
socket.write(Buffer.from([0x1b, 0x40]));
socket.write(Buffer.from([0x1b, 0x69, 0x53]));
// Some firmware only answers once it is in raster mode, so ask again that way
// before giving up.
setTimeout(() => {
if (!chunks.length && !socket.destroyed) {
socket.write(Buffer.from([0x1b, 0x69, 0x61, 0x01]));
socket.write(Buffer.from([0x1b, 0x69, 0x53]));
}
}, 1500);
});
socket.on('data', (d) => {
@@ -113,8 +122,20 @@ socket.on('timeout', () => {
socket.destroy();
if (!chunks.length) {
console.error(' The printer accepted the connection but sent nothing back.');
console.error(' Some firmware only answers when idle — make sure it is not mid-job,');
console.error(' and that nothing else is holding port 9100 open.\n');
console.error('');
console.error(' Many Brother network print servers are write-only on port 9100: they accept');
console.error(' jobs but never report status, even though the same printer answers happily');
console.error(' over USB. If this is one of them, no amount of asking will help.');
console.error('');
console.error(' Read the printer instead from:');
console.error(' - the display on the machine itself');
console.error(' - Brother Status Monitor, on a PC with the printer installed');
console.error(' - the printer\'s own web page, at http://' + host + '/');
console.error('');
console.error(' Status Monitor in particular gives the exact reason a job was refused,');
console.error(' which is more than brother_ql can tell you — its network backend never');
console.error(' reads the socket, so it reports success whatever the printer does.');
console.error('');
process.exit(1);
}
});