weewx icon indicating copy to clipboard operation
weewx copied to clipboard

implement usb abstraction for multiple usb programming interfaces

Open matthewwall opened this issue 10 years ago • 3 comments

refactor the usb implementation for every driver that talks to hardware that shows up as human-interface device (HID). libusb works fine on linux, but it does not work with HID hardware on macosx. there are multiple libusb implementations (1.0.x vs 0.1.x) as well as multiple pyusb implementations (1.x vs 0.1.x vs 0.4.x), and these do not always work seamlessly (despite the efforts of the pyusb folks to provide an api that works with various backends).

as an example, see jim easterbrook's work in pywws, specifically the src/pywws/device_*.py files.

matthewwall avatar Jan 16 '16 22:01 matthewwall

some references for macosx:

http://www.libusb.org/ticket/89 https://github.com/libusb/libusb/wiki/FAQ https://developer.apple.com/library/mac/technotes/tn2315/_index.html https://developer.apple.com/library/mac/qa/qa1076/_index.html http://stackoverflow.com/questions/14302935/codeless-kext-on-os-x http://stackoverflow.com/questions/3368008/reading-and-writing-to-usb-hid-interrupt-endpoints-on-mac http://stackoverflow.com/questions/7263648/codeless-kext-loading-problem http://stackoverflow.com/questions/33545656/codeless-kext-for-usb-storage-device

the pywws implementation: https://github.com/jim-easterbrook/pywws/tree/master/src/pywws

there are 5 interfaces: cython_hidapi ctypes_hidapi libusb1 pyusb1 pyusb

matthewwall avatar Jan 16 '16 22:01 matthewwall

the usb branch now contains an implementation for pyusb1, pyusb, and cython_hidapi. it also includes ctypes_hidapi and libusb1, but i have not yet tested those.

i am testing these initially with the hp3000 and wh23xx drivers on debian8 and macosx 10.10. these are mostly working as of end of february 2017.

however, i'm afraid it will be rather a slog. even though all of the existing weewx usb drivers talk to usb hid hardware, each type of hardware does different things. some write using interrupt_write, which others first send a control_message before doing a read or write.

so it means a combinatorial mess of testing.

we should target a minimal set: pyusb, pyusb1, and cython_hidapi

matthewwall avatar Feb 28 '17 00:02 matthewwall

This issue is getting on 5 years old.

Is it still a problem?

tkeffer avatar Nov 12 '20 02:11 tkeffer