diff --git a/nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix b/nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix index 7ea384dcbce..432f0316a4f 100644 --- a/nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix +++ b/nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix @@ -21,8 +21,8 @@ nix-build -E 'let pkgs = import ./. {}; brscan5-etc-files = pkgs.callPackage (import ./nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix) {}; in brscan5-etc-files.override { netDevices = [ - {name="a"; model="MFC-7860DW"; nodename="BRW0080927AFBCE";} - {name="b"; model="MFC-7860DW"; ip="192.168.1.2";} + {name="a"; model="ADS-1200"; nodename="BRW0080927AFBCE";} + {name="b"; model="ADS-1200"; ip="192.168.1.2";} ]; }' ~~~ @@ -58,7 +58,7 @@ stdenv.mkDerivation { cp -rp "./brscan5.ini" "$TARGET_DIR" cp -rp "./brsanenetdevice.cfg" "$TARGET_DIR" - export NIX_REDIRECTS="/etc/opt/brother/scanner/brscan5//brsanenetdevice.cfg=$TARGET_DIR/brsanenetdevice.cfg" + export NIX_REDIRECTS="/etc/opt/brother/scanner/brscan5/=$TARGET_DIR/" printf '${addAllNetDev netDevices}\n' diff --git a/nixos/tests/brscan5.nix b/nixos/tests/brscan5.nix index af5333126b5..715191b383c 100644 --- a/nixos/tests/brscan5.nix +++ b/nixos/tests/brscan5.nix @@ -15,8 +15,8 @@ import ./make-test-python.nix ({ pkgs, ...} : { brscan5 = { enable = true; netDevices = { - "a" = { model="MFC-7860DW"; nodename="BRW0080927AFBCE"; }; - "b" = { model="MFC-7860DW"; ip="192.168.1.2"; }; + "a" = { model="ADS-1200"; nodename="BRW0080927AFBCE"; }; + "b" = { model="ADS-1200"; ip="192.168.1.2"; }; }; }; }; @@ -24,11 +24,19 @@ import ./make-test-python.nix ({ pkgs, ...} : { testScript = '' # sane loads libsane-brother5.so.1 successfully, and scanimage doesn't die - assert 'libsane-brother5.so.1", O_RDONLY|O_CLOEXEC) = 10' in machine.succeed('strace scanimage -L 2>&1') + strace = machine.succeed('strace scanimage -L 2>&1').split("\n") + regexp = 'openat\(.*libsane-brother5.so.1", O_RDONLY|O_CLOEXEC\) = \d\d*$' + assert len([x for x in strace if re.match(regexp,x)]) > 0 # module creates a config cfg = machine.succeed('cat /etc/opt/brother/scanner/brscan5/brsanenetdevice.cfg') - assert 'DEVICE=a , "MFC-7860DW" , Unknown , NODENAME=BRW0080927AFBCE' in cfg - assert 'DEVICE=b , "MFC-7860DW" , Unknown , IP-ADDRESS=192.168.1.2' in cfg + assert 'DEVICE=a , "ADS-1200" , 0x4f9:0x459 , NODENAME=BRW0080927AFBCE' in cfg + assert 'DEVICE=b , "ADS-1200" , 0x4f9:0x459 , IP-ADDRESS=192.168.1.2' in cfg + + # scanimage lists the two network scanners + scanimage = machine.succeed("scanimage -L") + print(scanimage) + assert """device `brother5:net1;dev0' is a Brother b ADS-1200""" in scanimage + assert """device `brother5:net1;dev1' is a Brother a ADS-1200""" in scanimage ''; })