Hantek6022API
Hantek6022API copied to clipboard
Trying to get firmware upload example running ...
Hi. Here's where my testing stands. I have a 6022BL, not BE, but for the purposes of this code the only relevant difference should be the USB PID. I've switched the PID over to match the BE so the code here successfully opens the device. When I try example_linux_flashfirmware.py, I get:
Traceback (most recent call last):
File "examples/example_linux_flashfirmware.py", line 8, in
I am not convinced that I have the included firmware (either stock or custom) set up properly, however.
Any suggestions? Thanks very much.
L
If I had to guess just looking at that traceback, we're attempt to encode something that isn't a string (but is rather just a char * like payload).
Is this on Python 2 or Python 3? That encode method call really shouldn't be there (or anywhere in that codebase), as nothing that gets passed around in the library should ever be a "textual" string. I think if you remove encode, and make sure that if this is Python 3 that the data packets are bytearray or bytes types (instead of str), this will work.
On Mon, Mar 7, 2016 at 7:15 PM, Lauren Weinstein [email protected] wrote:
Hi. Here's where my testing stands. I have a 6022BL, not BE, but for the purposes of this code the only relevant difference should be the USB PID. I've switched the PID over to match the BE so the code here successfully opens the device. When I try example_linux_flashfirmware.py, I get:
Traceback (most recent call last): File "examples/example_linux_flashfirmware.py", line 8, in scope.flash_firmware() File "/git/Hantek6022API/PyHT6022/LibUsbScope.py", line 149, in flash_firmware data = packet.data.encode('ascii') if isinstance(packet.data, str) else packet.data UnicodeDecodeError: 'ascii' codec can't decode byte 0xb9 in position 2: ordinal not in range(128)
I am not convinced that I have the included firmware (either stock or custom) set up properly, however.
Any suggestions? Thanks very much.
L
— Reply to this email directly or view it on GitHub https://github.com/rpcope1/Hantek6022API/issues/28.
I haven't made any changes to the formats of the firmware files as provided. My initial tests were with python 2.7.6. I have 3.4.3 also, but I have to figure out how to install libusb for that as a start -- pip doesn't seem to be working correctly. Thanks.
OK, I got to the point with python3 where I could run the firmware upload -- in its default configuration -- and received no error messages (or confirmation messages -- it simply exits). No red or green lights lit on the Hantek. Due to problems installing pylab for python3 (dependency errors, see below), I ended up running scopevis.py using python2 (after running the firmware upload using python3, that is). Errors from pylab install attempt below. Next post is results from scopevis.py.
pip3 install pylab Downloading/unpacking pylab Downloading pylab-0.1.3-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python3/dist-packages (from pylab) Downloading/unpacking scikit-learn (from pylab) Downloading scikit-learn-0.17.1.tar.gz (7.9MB): 7.9MB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/scikit-learn/setup.py) egg_info for package scikit-learn Partial import of sklearn during the build process.
Downloading/unpacking jinja2 (from pylab) Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB): 263kB downloaded Downloading/unpacking pyzmq (from pylab) Downloading pyzmq-15.2.0.tar.gz (1.1MB): 1.1MB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/pyzmq/setup.py) egg_info for package pyzmq
Generating grammar tables from /usr/lib/python3.4/lib2to3/Grammar.txt
Generating grammar tables from /usr/lib/python3.4/lib2to3/PatternGrammar.txt
warning: no files found matching 'tox.ini'
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'docs/gh-pages'
warning: no previously-included files found matching 'bundled/zeromq/src/Makefile*'
warning: no previously-included files found matching 'bundled/zeromq/src/platform.hpp'
warning: no previously-included files found matching 'setup.cfg'
warning: no previously-included files found matching 'zmq/libzmq*'
warning: no previously-included files matching '.deps/*' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '.mailmap' found anywhere in distribution
warning: no previously-included files matching 'Makefile.am' found anywhere in distribution
warning: no previously-included files matching 'Makefile.in' found anywhere in distribution
Downloading/unpacking networkx (from pylab) Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded Downloading/unpacking seaborn (from pylab) Downloading seaborn-0.7.0.tar.gz (154kB): 154kB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/seaborn/setup.py) egg_info for package seaborn
Downloading/unpacking matplotlib (from pylab) Downloading matplotlib-1.5.1.tar.gz (54.0MB): 54.0MB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib ============================================================================ Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.1]
python: yes [3.4.3 (default, Oct 14 2015, 20:28:29) [GCC
4.8.4]]
platform: yes [linux]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.2]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may attempt to
install it after matplotlib.]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
cycler: yes [cycler was not found. pip will attempt to
install it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [using pyparsing version 2.0.1]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: yes [version 2.5.2]
png: yes [version 1.2.50]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / using
unittest.mock]
toolkits_tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / using
unittest.mock]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: yes [installing, version 3.8.10]
gtk3cairo: yes [installing, version 3.8.10]
gtkagg: no [Requires pygtk]
tkagg: no [TKAgg requires Tkinter.]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: yes [installing, pycairo version 1.10.0]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: yes [version 9.10]
latex: no
pdftops: yes [version 0.24.5]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
Downloading/unpacking tornado (from pylab) Downloading tornado-4.3.tar.gz (450kB): 450kB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/tornado/setup.py) egg_info for package tornado
no previously-included directories found matching 'docs/build'
warning: no files found matching 'tornado/test/README'
Downloading/unpacking pytz (from pylab) Downloading pytz-2015.7-py2.py3-none-any.whl (476kB): 476kB downloaded Downloading/unpacking scipy (from pylab) Downloading scipy-0.17.0.tar.gz (12.4MB): 12.4MB downloaded Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/scipy/setup.py) egg_info for package scipy
warning: no previously-included files matching '*_subr_*.f' found under directory 'scipy/linalg/src/id_dist/src'
no previously-included directories found matching 'benchmarks/env'
no previously-included directories found matching 'benchmarks/results'
no previously-included directories found matching 'benchmarks/html'
no previously-included directories found matching 'benchmarks/scipy'
no previously-included directories found matching 'scipy/special/tests/data/boost'
no previously-included directories found matching 'scipy/special/tests/data/gsl'
no previously-included directories found matching 'doc/build'
no previously-included directories found matching 'doc/source/generated'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
Downloading/unpacking scikit-image (from pylab)
Downloading scikit-image-0.12.2.tar.gz (20.6MB): 20.6MB downloaded
Running setup.py (path:/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/scikit-image/setup.py) egg_info for package scikit-image
Unable to find pgen, not compiling formal grammar.
No eggs found in /e/tmp/easy_install-esu360hx/Cython-0.23.4/egg-dist-tmp-9tggyy__ (setup script problem?)
Traceback (most recent call last):
File "
No eggs found in /e/tmp/easy_install-esu360hx/Cython-0.23.4/egg-dist-tmp-9tggyy__ (setup script problem?)
Traceback (most recent call last):
File "
File "/var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/scikit-image/setup.py", line 146, in
**extra
File "/usr/lib/python3/dist-packages/numpy/distutils/core.py", line 126, in setup
dist = setup(**new_attr)
File "/usr/lib/python3/dist-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/numpy/distutils/numpy_distribution.py", line 16, in init
Distribution.__init__(self, attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 239, in init
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggs
replace_conflicting=True
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: cython>=0.21
Cleaning up... Command python setup.py egg_info failed with error code 1 in /var/host/media/removable/SG-USB-5TB-001/tmp/pip_build_root/scikit-image Storing debug log for failure in /root/.pip/pip.log
First run of scopevis.py: data lengths differ! [('timing', 8192), ('voltage', 0)] -- then exits
Second run: data lengths differ! [('timing', 8192), ('voltage', 251)] -- then exits
Third run: data lengths differ! [('timing', 8192), ('voltage', 556)] -- then exits
Fourth run: "Scope Visualization Example" appeared: