From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH zbar 1/1] Add simple dbus IPC API to zbarcam.
Date: Wed, 16 Jan 2019 20:14:48 -0200 [thread overview]
Message-ID: <20190116201448.295b66cd@coco.lan> (raw)
In-Reply-To: <CADvTj4oL+h=bgk1yusG0LqEC2itDQ-bThKqEFsztuG6BEqEw-Q@mail.gmail.com>
Em Wed, 16 Jan 2019 13:37:58 -0700
James Hilliard <james.hilliard1@gmail.com> escreveu:
> On Wed, Jan 16, 2019 at 7:37 AM Mauro Carvalho Chehab
> <mchehab+samsung@kernel.org> wrote:
> >
> > Hi James,
> >
> > Em Wed, 16 Jan 2019 16:54:55 +0800
> > james.hilliard1@gmail.com escreveu:
> >
> > > From: James Hilliard <james.hilliard1@gmail.com>
> > >
> > > This is useful for running zbarcam as a systemd service so that other
> > > applications can receive scan messages through dbus.
> >
> > Nice approach!
> >
> > Yet, I would try to write it on a different way, making sure that it
> > could also be using by zbarimg.
> >
> > I mean, if you add the dbus bindings inside the zbar core, it
> > shouldn't matter if the source image comes via a webcam or via a
> > scanned image. Both will be able to send the scancodes via dbus.
> Which function should I call send_dbus() from in that case?
Good question.
Tests required, but I suspect that you could add it at processor.c,
inside _zbar_process_image().
I suspect that, if you do something like:
if(nsyms) {
/* FIXME only call after filtering */
_zbar_mutex_lock(&proc->mutex);
_zbar_processor_notify(proc, EVENT_OUTPUT);
_zbar_mutex_unlock(&proc->mutex);
if(proc->handler)
proc->handler(img, proc->userdata);
+ if(proc->is_dbus_enabled)
+ zbar_send_code_via_dbus(proc->userdata);
}
should work.
You could easily check if this is working by calling:
$ ./zbarimg/zbarimg ./examples/barcode.png
EAN-13:9876543210128
scanned 1 barcode symbols from 1 images in 0.2 seconds
(I would add a flag to allow enabling/disabling it by applications).
> >
> > As a future approach, we may even think on making the interface
> > duplex in the future, e. g. allowing any camera application to
> > send an image via dbus and let zbar to decode it and return
> > the decoded bar codes.
> That could be useful, probably too difficult for me to implement
> myself though(I don't write a lot of c usually).
As I said, this is just an idea for a future possible development.
Not sure how this would actually work, as dbus may not be the best
interface for passing images.
Thanks,
Mauro
prev parent reply other threads:[~2019-01-16 22:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 8:54 [PATCH zbar 1/1] Add simple dbus IPC API to zbarcam james.hilliard1
2019-01-16 14:36 ` Mauro Carvalho Chehab
2019-01-16 20:37 ` James Hilliard
2019-01-16 22:14 ` Mauro Carvalho Chehab [this message]
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=20190116201448.295b66cd@coco.lan \
--to=mchehab+samsung@kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=linux-media@vger.kernel.org \
/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.