You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: PwrUSBDevice drove the strip only through USBPort (libusb). On macOS
the OS IOHIDFamily driver claims the HID interface, so libusb cannot open it
(USBError [Errno 13] Access denied) and there is no /dev node for SerialPort
either. The strip was therefore unreachable on macOS.
Solution: Add HIDPort, a CommunicationPort backed by hidapi (IOKit on macOS),
alongside SerialPort and USBPort. Because it implements the same primitives
(open/close/readData/writeData/flush), PwrUSBDevice's do* methods are unchanged;
only transport selection is added: PwrUSBDevice(transport="hid"|"usb"|"auto"),
default "auto" (HID when hidapi is importable, else USB). hidapi is optional,
installed via the new pwrusb extra (pip install -e .[pwrusb]).
Verified end to end on the lab unit (a PowerUSB "Basic", 04d8:003f): auto-
selects HID, opens, and switches outlets 1/2/3 on and off. flush() drains with
a bounded, strictly positive per-read timeout: hidapi blocks on timeout_ms=0
rather than returning, so a zero timeout would hang. The strip sends no
unsolicited reports and answers a query with a 64-byte report whose leading
byte(s) carry the datum; metering values are only meaningful on a metering-
capable ("Smart") unit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments