Closed s-light closed 5 years ago
Thanks for the research. Please compare with https://github.com/jnweiger/inkscape-silhouette/blob/master/silhouette/Graphtec.py#L30 and the issues in this repo regarding cross platform support.
this comment is just a list / overview of the different python hid packages i found during research:
pypi | source | apt |
---|---|---|
hid | pyhidapi | ? []() |
hidapi | cython-hidapi | python-hid |
hidapi-cffi | hidapi-cffi | python-hidapi |
pyhidapi | pyhidapi | ? []() |
For windows there is also pywinusb, which can be used like this:
#
# (install python from python.org)
# [x] install Launcher for all Users
# [x] Add Python 3.7 to PATH
# pip install pywinusb
#
import pywinusb.hid as hid
filter = hid.HidDeviceFilter(vendor_id=0x0416, product_id=0x5020)
dev = filter.get_devices()[0]
print(dev)
dev.open()
report = dev.find_output_reports()[0]
print(report)
buffer= [0x00]*65
buffer[0]=0x0
buffer[1]=0x01
buffer[2]=0x00
buffer[3]=0x01
report.send(buffer)
dev.close()
But the send buffer must be exactly 65 bytes. Probably not raw enough for us.
pywinusb has a report.set_raw_data() method, but that is still not sufficiently raw. wireshark shows only some parts of my message getting through, with other data intermixed. Not suitable for us.
if packaging is consider: have a look at this stackoverflow question for some options.. likely gets complicated with this hole librarie things...
Commit https://github.com/jnweiger/led-badge-44x11/commit/c47bc9a03a34f5f15705bbf9c90036bf056b82b0 should bring in windows10 support.
@AnnabelleLee1987, @s-light The installation procedures on Ubuntu, Mac, and Windows are now all described in the README. None of them are trivial, sorry. Please test, if that gets you going. Thanks!
pyinstaller and py2exe from the stackoverflow link above may help to simplify this. For me the current state seems good enough for now.
Should we close here, or keep this open for reference?
i think we can close this - as the original request is - at least partly - solved.
just some closing thoughts: currently i think we know that the only way to streamline all this is :
→ but i don't know if one of this is in any way easy possible..
inf-wizard seems to explode under windows 7, without installing any drivers.
1) Start als "admin"
2) \
idea: would be nice to have a easy way (for a normal end-user) to install this cross-platform.
this is a collection of things i found during my search & how it could work - all untested yet...
libusb
currently the script uses libusb to access the HID-Device. its easy to install for linux but a little bit harder for Mac OS or windows: (as fare as i found - please proof me wrong?! ;-) )
sudo apt install python3-usb
(as written in the current instructions) this installs libusb and pyusb (info from package description)brew install libusb
additionally we need pyusb:pip3 install pyusb
there is libusb at pypi (github) that states:
and yes- if you look at the source it includes the dll. but as mentioned - only for windows :crying_cat_face:
other option: switch library ?
the libusb FAQ also recommends the HIDAPI library for HID things. but it seems this lib is a bit in a unmaintained state currently.. on my search i found cython-hidapi as a python API for this. (called hidapi at pypi) → this would mean Cython as dependency.. i also found pyhidapi (named hid in pypi) but installation in osx seems trouble some too...
result
there is no easy to install solution already out there?
hope someone else has better news on this ;-)