feat: Kindle: add uevent listener for input device hotplug#2327
Open
zampierilucas wants to merge 1 commit intokoreader:masterfrom
Open
feat: Kindle: add uevent listener for input device hotplug#2327zampierilucas wants to merge 1 commit intokoreader:masterfrom
zampierilucas wants to merge 1 commit intokoreader:masterfrom
Conversation
Add a netlink uevent listener alongside the existing lipc-wait-event loop in input-kindle.h. This allows KOReader to detect dynamically created input devices (e.g., UHID keyboards from kindle-hid-passthrough) after startup. The listener runs as a forked child of the fake event generator process, using libue (already in the repo) to watch for input subsystem add/remove events. When a new /dev/input/eventX appears, it emits CODE_FAKE_USB_DEVICE_PLUGGED_IN (10040) with the evdev number; on removal, CODE_FAKE_USB_DEVICE_PLUGGED_OUT (10041). This is the same mechanism Kobo uses for USB OTG keyboards (input-kobo.h), adapted for Kindle where UHID devices appear under /devices/virtual/input/. Unlike Kobo, we don't filter on devpath since built-in Kindle input devices are static and won't generate add/remove uevents. Closes: koreader/koreader#14359
This was referenced Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user (@alllexx88, kindle-hid-passthrough#40) pointed out that keyboards connected via kindle-hid-passthrough don't work in KOReader because KOReader never discovers the dynamically created
/dev/input/eventXdevice.On Kobo, input-kobo.h already uses libue to listen for netlink uevents and emit
CODE_FAKE_USB_DEVICE_PLUGGED_IN/OUTwhen new input devices appear. Kindle's input-kindle.h had no equivalent, only the lipc-wait-event loop for power/charging events. This patch adds a uevent listener as a forked child alongside the existing lipc loop, using the same libue library already in the repo. When a new evdev node appears (e.g., a UHID keyboard), it emits the same fake event codes that the Kobo path uses, so the existing externalkeyboard plugin can handle it. Tested on a Kindle PW4 with kindle-hid-passthrough and a BLE keyboard, KOReader correctly shows the "Keyboard connected" banner and accepts input.Ref koreader/koreader#14359
This change is