From 899ef496e97fcc9a8dd79eebc384c60130d413f8 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Mon, 6 Mar 2023 20:45:42 +0000 Subject: [PATCH] `--source` before `--mode` See #573 --- packages/server/src/classes/scanimage-command.js | 10 ++++------ packages/server/test/scanimage-command.test.js | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/server/src/classes/scanimage-command.js b/packages/server/src/classes/scanimage-command.js index 353d1af6..f173e4e2 100644 --- a/packages/server/src/classes/scanimage-command.js +++ b/packages/server/src/classes/scanimage-command.js @@ -73,18 +73,16 @@ module.exports = class ScanimageCommand { const cmdBuilder = new CommandBuilder(this.config.scanimage); cmdBuilder.arg('-d', params.deviceId); - if ('mode' in params) { - cmdBuilder.arg('--mode', params.mode); - } - - // Source needs to go before resolution if ('source' in params) { cmdBuilder.arg('--source', params.source); } - + if ('mode' in params) { + cmdBuilder.arg('--mode', params.mode); + } if ('adfMode' in params) { cmdBuilder.arg('--adf-mode', params.adfMode); } + cmdBuilder.arg('--resolution', params.resolution); if ('pageWidth' in params) { diff --git a/packages/server/test/scanimage-command.test.js b/packages/server/test/scanimage-command.test.js index 0f2a078d..ccbed39d 100644 --- a/packages/server/test/scanimage-command.test.js +++ b/packages/server/test/scanimage-command.test.js @@ -78,7 +78,7 @@ describe('ScanimageCommand', () => { const command = commandFor('1.0.31', request); // eslint-disable-next-line quotes - assert.strictEqual(command, `/usr/bin/scanimage -d epjitsu:libusb:001:003 --mode Color --source 'ADF Front' --resolution 300 --page-width 215.8 --page-height 292 -t 0 --format tiff --brightness 0 --contrast 0 -o data/temp/~tmp-scan-0-0001.tif`); + assert.strictEqual(command, `/usr/bin/scanimage -d epjitsu:libusb:001:003 --source 'ADF Front' --mode Color --resolution 300 --page-width 215.8 --page-height 292 -t 0 --format tiff --brightness 0 --contrast 0 -o data/temp/~tmp-scan-0-0001.tif`); }); it('scanimage-a14.txt', () => { @@ -92,7 +92,7 @@ describe('ScanimageCommand', () => { }); const command = commandFor('1.1.1', request); // eslint-disable-next-line quotes - assert.strictEqual(command, `/usr/bin/scanimage -d 'fujitsu:ScanSnap S1500:8176' --mode Lineart --source 'ADF Front' --resolution 600 --page-width 215.8 --page-height 279.3 -l 0 -t 0 -x 215.8 -y 279.3 --format tiff --ald=yes --brightness 0 -o data/temp/~tmp-scan-0-0001.tif`); + assert.strictEqual(command, `/usr/bin/scanimage -d 'fujitsu:ScanSnap S1500:8176' --source 'ADF Front' --mode Lineart --resolution 600 --page-width 215.8 --page-height 279.3 -l 0 -t 0 -x 215.8 -y 279.3 --format tiff --ald=yes --brightness 0 -o data/temp/~tmp-scan-0-0001.tif`); }); });