Commit Graph

4 Commits

Author SHA1 Message Date
MasterofJOKers bbc8180aa2 udev-device-plug-handler: Scan to PNG
Instead of scanning to the default PNM format, we scan to PNG. PNM isn't
that well-supported in normal image handling software.
2024-05-31 21:23:02 +02:00
MasterofJOKers 28901649dc udev-device-plug-handler: Handle Canon LiDE400
When this scanner is plugged in, we want to start `scanimage` in batch
mode with button support, scanning into a pre-defined directory. Since
plug and unplug might happen multiple times a day and batch mode
overwrites files with the same name, we use date and time to define
directory and filename.
2024-02-03 13:59:22 +01:00
MasterofJOKers 0c2dd51ac1 udev-device-plug-handler: Support more than bind
There can be cases where we want to support more than "bind" events -
e.g. "remove". Therefore, we rewrite how things work in the spirit of
the STLs `SimpleHTTPRequestHandler`: any "handle_{action}" method of a
`KnownDevice` subclass allows the class to receive events for that
action.

To not use `getattr()` on every `KnownDevice` on every event, we use
`__init_subclass__()` to build a list of `KnownDevice` registered for
each `action`.
2024-02-03 13:55:52 +01:00
MasterofJOKers 2f9f69ec77 Add udev-device-plug-handler
This command runs in the background and listens for udev bind events,
comparing the attributes of those events to known implemented devices.
If any match, we call their handle() method. The same handle() method is
called on startup if the presence of the device is detected via the
check_available() method.

Currently implemented devices are my Logitech G930 headset and my TEX
Shinobi keyboard.
2022-09-06 20:47:01 +02:00