summary refs log tree commit diff
path: root/pkgs/applications/graphics/sane
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien+git@xlumurb.eu>2022-11-04 12:00:00 +0000
committerGuillaume Girol <symphorien+git@xlumurb.eu>2022-11-04 18:51:01 +0100
commitb4cbe1dac3684e732d1cc5c12c0a788859080c2d (patch)
tree695436baecf194631752e4a84a574d17f828b319 /pkgs/applications/graphics/sane
parenta2a777538d971c6b01c6e54af89ddd6567c055e8 (diff)
downloadnixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar.gz
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar.bz2
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar.lz
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar.xz
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.tar.zst
nixpkgs-b4cbe1dac3684e732d1cc5c12c0a788859080c2d.zip
sane_backends: more complete hwdb files
We used to ship the pre-computed udev rules that are distributed in the
tarballs. This is problematic as it changes the group of scanners to
scanner which removes the group lp and prevents cups from using it.
(https://github.com/NixOS/nixpkgs/issues/147217)
For this reason we switched to generating udev and hwdb files as follows:

    ./tools/sane-desc -m udev+hwdb -s doc/descriptions:doc/descriptions-external > $out/etc/udev/rules.d/49-libsane.rules
    ./tools/sane-desc -m udev+hwdb -s doc/descriptions -m hwdb > $out/etc/udev/hwdb.d/20-sane.hwdb

following what other distros do.
(https://github.com/NixOS/nixpkgs/pull/176412)

this is great, but sane-desc does not include unsupported .desc entries
like EPSON V300 PHOTO, which was present in the distributed udev rules.
So even when installing all the required unfree stuff to make the
corresponding epkowa backend work, it only works as root as there is no
corresponding hwdb entry. As the .desc entry contains the usb ids, we
can just patch sane-desc to generate hwdb entries even for unsupported
models.
Diffstat (limited to 'pkgs/applications/graphics/sane')
-rw-r--r--pkgs/applications/graphics/sane/backends/default.nix3
-rw-r--r--pkgs/applications/graphics/sane/backends/sane-desc-generate-entries-unsupported-scanners.patch19
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/sane/backends/default.nix b/pkgs/applications/graphics/sane/backends/default.nix
index 2364b450835..b867269db05 100644
--- a/pkgs/applications/graphics/sane/backends/default.nix
+++ b/pkgs/applications/graphics/sane/backends/default.nix
@@ -37,6 +37,9 @@ stdenv.mkDerivation {
       url = "https://raw.githubusercontent.com/void-linux/void-packages/4b97cd2fb4ec38712544438c2491b6d7d5ab334a/srcpkgs/sane/patches/sane-desc-cross.patch";
       sha256 = "sha256-y6BOXnOJBSTqvRp6LwAucqaqv+OLLyhCS/tXfLpnAPI=";
     })
+    # generate hwdb entries for scanners handled by other backends like epkowa
+    # https://gitlab.com/sane-project/backends/-/issues/619
+    ./sane-desc-generate-entries-unsupported-scanners.patch
   ];
 
   postPatch = ''
diff --git a/pkgs/applications/graphics/sane/backends/sane-desc-generate-entries-unsupported-scanners.patch b/pkgs/applications/graphics/sane/backends/sane-desc-generate-entries-unsupported-scanners.patch
new file mode 100644
index 00000000000..0fbe9f31c3f
--- /dev/null
+++ b/pkgs/applications/graphics/sane/backends/sane-desc-generate-entries-unsupported-scanners.patch
@@ -0,0 +1,19 @@
+sane-desc does not include unsupported .desc entries like EPSON V300 PHOTO,
+which can be supported by the (unfree) epkowa driver.
+But we need those entries so that unprivileged users which have installed epkowa
+can use the scanner.
+diff --git a/tools/sane-desc.c b/tools/sane-desc.c
+index 7a8645dea..9c9719fef 100644
+--- a/tools/sane-desc.c
++++ b/tools/sane-desc.c
+@@ -3243,10 +3243,6 @@ create_usbids_table (void)
+ 
+ 	      for (model = mfg->model; model; model = model->next)
+ 		{
+-		  if ((model->status == status_unsupported)
+-		      || (model->status == status_unknown))
+-		    continue;
+-
+ 		  if (model->usb_vendor_id && model->usb_product_id)
+ 		    {
+ 		      first_usbid = add_usbid (first_usbid, mfg->name,