[fprint] UART Helpers Needed?
Benjamin Berg
benjamin at sipsolutions.net
Thu Mar 24 12:59:56 UTC 2022
On Wed, 2022-03-23 at 17:06 +0000, Charlie Lin wrote:
> Asking for a bit of advice. My fingerprint scanner communicates via UART, and
> apparently the existing helper functions only work for fingerprint scanners
> that communicate via USB or SPI. If I need to create such helpers for UART,
> how should I start?
Well, UART is simple, it is just an FD that we read/write. We don't
need much here really, all we want is a simple asynchronous API that
mirrors what we already have for USB and SPI.
Two ways to implement it:
* Use g_unix_fd_source_new, with read/write
* Use a GIOChannel, with g_io_create_watch, etc.
* Use GIOStream
Doesn't really matter which one. One important thing is that you create
the GSource manually and attach it to the correct GMainContext. i.e.
use g_main_context_get_thread_default and then g_source_attach (we
might want to add an internal API to register a GSource with the
device).
Maybe I should write that myself, it should be pretty simple overall.
But not sure if I'll get around to it this week. You can open an issue
in the libfprint repository.
Benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/fprint/attachments/20220324/540e20b9/attachment.sig>
More information about the fprint
mailing list