all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH pbs 1/2] pbs-datastore: paperkey: Add padding to utf8 qrcodes
Date: Tue, 13 Jun 2023 12:47:29 +0200	[thread overview]
Message-ID: <20230613104730.120991-1-m.sandoval@proxmox.com> (raw)

Many QR code scanners, including ZBar for example, cannot read qr codes
properly when there is not padding around them.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-datastore/src/paperkey.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pbs-datastore/src/paperkey.rs b/pbs-datastore/src/paperkey.rs
index 14b62264..6d8cd914 100644
--- a/pbs-datastore/src/paperkey.rs
+++ b/pbs-datastore/src/paperkey.rs
@@ -226,8 +226,12 @@ fn paperkey_text<W: Write>(
 }
 
 fn generate_qr_code(output_type: &str, lines: &[String]) -> Result<Vec<u8>, Error> {
+    let padding = match output_type {
+        "utf8" | "utf8i" => "-m2",
+        _ => "-m0",
+    };
     let mut child = Command::new("qrencode")
-        .args(["-t", output_type, "-m0", "-s1", "-lm", "--output", "-"])
+        .args(["-t", output_type, padding, "-s1", "-lm", "--output", "-"])
         .stdin(Stdio::piped())
         .stdout(Stdio::piped())
         .spawn()?;
-- 
2.39.2





             reply	other threads:[~2023-06-13 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 10:47 Maximiliano Sandoval [this message]
2023-06-13 10:47 ` [pbs-devel] [PATCH pbs 2/2] fix #4734: manager: add tfa {list, delete, add} commands Maximiliano Sandoval
2023-06-20 11:54   ` Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230613104730.120991-1-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal