Solaar/lib/hidapi
Ken Sanislo 25865994cb
device: Treat empty hidraw read as device removal (EOF) (#3174)
* Treat empty hidraw read as device removal (EOF)

When select() reports a hidraw fd as readable but os.read() returns
empty bytes, that's EOF per POSIX — the device has been removed.
Previously this was silently treated as no data, causing the listener
to loop indefinitely on a gone device instead of cleaning up.

* Fix test_ping_errors missing mocks for _read_input_buffer and write

The test was not mocking _read_input_buffer or write, so ping() would
call into real hidapi.read() with a fake handle (fd 1). The empty-read
EOF detection added in the previous commit made this consistently fail
by raising OSError → NoReceiver before reaching the mocked _read path.

Add the same mocks used by the adjacent test_request_errors.

---------

Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
2026-04-14 11:56:01 -04:00
..
__init__.py hidapi: Explicitly load hidapi/udev implementation 2024-10-11 07:42:38 -04:00
common.py centurion: support PRO X 2 LIGHTSPEED headphones Centurion features (#3150) 2026-04-14 11:43:23 -04:00
hidapi_impl.py Skip Logitech webcams to prevent them from locking up during HID++ checks on Macs 2026-02-28 10:50:36 -05:00
hidconsole.py tools: improve flags for hidconsole 2025-12-19 10:55:50 -05:00
udev_impl.py device: Treat empty hidraw read as device removal (EOF) (#3174) 2026-04-14 11:56:01 -04:00