From 0c860ba8855876c05fb806350a6785eaf80d0a79 Mon Sep 17 00:00:00 2001 From: Nigel Armstrong Date: Mon, 2 Feb 2026 21:13:34 -0800 Subject: [PATCH] Include hidapi error message on open failrues HIDAPI has an error message for open failures, which this appends to the existing unable to open message. --- hid/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hid/__init__.py b/hid/__init__.py index 752ddf5..69d82eb 100644 --- a/hid/__init__.py +++ b/hid/__init__.py @@ -174,7 +174,8 @@ def __init__(self, vid=None, pid=None, serial=None, path=None): raise ValueError('specify vid/pid or path') if not self.__dev: - raise HIDException('unable to open device') + err = hidapi.hid_error(0) + raise HIDException('unable to open device: ' + err) def __enter__(self): return self