greatscottgadgets / libgreat Goto Github PK
View Code? Open in Web Editor NEWa library to help you do Great things
License: BSD 3-Clause "New" or "Revised" License
a library to help you do Great things
License: BSD 3-Clause "New" or "Revised" License
This is the tracking issue for the libgreat v2023.2.2 release.
I needed an additional package installed for greatfet to run. Running greatfet info
throws this error:
Traceback (most recent call last):
File "/usr/local/bin/greatfet", line 6, in <module>
from greatfet.commands.gf import main
File "/usr/local/lib/python2.7/dist-packages/greatfet/__init__.py", line 3, in <module>
from .greatfet import GreatFET
File "/usr/local/lib/python2.7/dist-packages/greatfet/greatfet.py", line 5, in <module>
from .board import GreatFETBoard
File "/usr/local/lib/python2.7/dist-packages/greatfet/board.py", line 12, in <module>
from pygreat.board import GreatBoard
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 15, in <module>
from pygreat.comms import CommsBackend
File "/usr/local/lib/python2.7/dist-packages/pygreat/comms.py", line 21, in <module>
from backports.functools_lru_cache import lru_cache as memoize_with_lru_cache
ImportError: No module named functools_lru_cache
Workaround is to install:
sudo apt install python-backports.functools-lru-cache
Linux 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
libgreat is not compatible with newer python versions.
greatfet/libgreat/host $ python setup.py build
WARNING: The wheel package is not available.
Traceback (most recent call last):
File "/home/user/greatfet/libgreat/host/setup.py", line 24, in <module>
setup(
File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.10/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 455, in __init__
_Distribution.__init__(self, {
File "/usr/lib64/python3.10/distutils/dist.py", line 292, in __init__
self.finalize_options()
File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 807, in finalize_options
ep(self)
File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 814, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/home/user/greatfet/libgreat/host/.eggs/even_better_setuptools_git_version-1.0.7-py3.10.egg/even_better_setuptools_git_version.py", line 83, in validate_version_config
if not isinstance(config, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
$ python -V
Python 3.10.0
$ cat /etc/fedora-release
Fedora release 35 (Thirty Five)
it seems to be the change mentioned here:
Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module.
googling for "python collections.Mapping removed" finds various other projects dealing with the issue, so probably a backwards-compatible way to change this can be found in one of them.
The pygreat README lacks detail, and still describes this as an experimental repo. It should probably be updated to at least mention (tersely) that it's a library with support for the LPC43xx, and which is meant to support GreatFET and forthcoming boards.
Looking in libgreat, the LCP4330 does not have the pins defined for the additional UARTS:
https://github.com/greatscottgadgets/libgreat/blob/master/firmware/platform/lpc43xx/drivers/platform_uart.c
/**
* Mapping that provides the location of the default pins for each UART.
*/
uart_pins_t uart_pins[] = {
{
.tx = { .group = 9, .pin = 5, .function = 7 },
.rx = { .group = 9, .pin = 6, .function = 7 }
// TODO: add flow control pins!
},
// FIXME: add the other UARTS!
};
Originally posted by @aussieklutz in greatscottgadgets/greatfet#383 (comment)
Hello there,
I'm not quite sure where to put this ticket. I know you all have done a fantastic job of keeping the firmware of the GreatFET One and the software in sync, packaged together (currently 2019.9.1).
Currently the pygreat-2019.9.1 package is missing a somewhat "critical" fix: 655a6a6 (addresses #7)
Without that update, anyone using Python 3.5+ won't be able to use the library. comms.py
crashes right away during device setup.
I was wondering: can you package up a 2019.12.1 version of pygreat into pypi?
Tested on Ubuntu 18.04.3 LTS, Python 3.6.9 (currently the default install for Ubuntu 18)
Thank you for your time, and keep up the great work!
As a dirty workaround to anyone using Ubuntu 18 that happens upon this issue, you can manually work around by changing this line in comms.py
(check your stack trace for the dist-packages location of pygreat):
if match.groups(1) is None:
return 1
else:
return int(match.groups(1))
To:
if match.groups(1) is None:
return 1
else:
return int(match.groups(1)[0])
I am attempting to use a GreatFET ONE with the Facedancer project on Ubuntu 16.04.06 LTS using Python 3.5. Trying to run any of the facedancer-XX.py examples results in the following exception:
GreatDancer initialized
GreatDancer connected device USB keyboard device
-- Reset requested! --
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 772, in execute_command
result = self.unpack(out_format, raw_result)
File "/usr/local/lib/python3.5/dist-packages/backports/functools_lru_cache.py", line 137, in wrapper
result = user_function(*args, **kwds)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 609, in unpack
bytes_consumed, raw_bytes = cls._split_off_bytes_for_format(subformat, raw_bytes)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 417, in _split_off_bytes_for_format
num_bytes_consumed = cls._get_bytes_consumed_by_format(format_string, raw_bytes)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 391, in _get_bytes_consumed_by_format
if match[1] is None:
TypeError: '_sre.SRE_Match' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./facedancer-keyboard.py", line 14, in <module>
d.run()
File ".../Facedancer/facedancer/USBDevice.py", line 166, in run
self.scheduler.run()
File ".../Facedancer/facedancer/core.py", line 512, in run
task()
File ".../Facedancer/facedancer/USBDevice.py", line 84, in <lambda>
self.scheduler.add_task(lambda : self.maxusb_app.service_irqs())
File ".../Facedancer/facedancer/backends/GreatDancerApp.py", line 747, in service_irqs
self._handle_setup_events()
File ".../Facedancer/facedancer/backends/GreatDancerApp.py", line 359, in _handle_setup_events
self._handle_setup_event_on_endpoint(i)
File ".../Facedancer/facedancer/backends/GreatDancerApp.py", line 374, in _handle_setup_event_on_endpoint
data = self.api.read_setup(endpoint_number)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 1088, in method
timeout=timeout, max_response_length=max_response_length, encoding=encoding, *arguments)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 1243, in execute_command
out_format, *arguments, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 779, in execute_command
future_utils.raise_with_traceback(outer_exception, sys.exc_info()[2])
File "/usr/local/lib/python3.5/dist-packages/future/utils/__init__.py", line 421, in raise_with_traceback
raise exc.with_traceback(traceback)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 772, in execute_command
result = self.unpack(out_format, raw_result)
File "/usr/local/lib/python3.5/dist-packages/backports/functools_lru_cache.py", line 137, in wrapper
result = user_function(*args, **kwds)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 609, in unpack
bytes_consumed, raw_bytes = cls._split_off_bytes_for_format(subformat, raw_bytes)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 417, in _split_off_bytes_for_format
num_bytes_consumed = cls._get_bytes_consumed_by_format(format_string, raw_bytes)
File "/usr/local/lib/python3.5/dist-packages/pygreat/comms.py", line 391, in _get_bytes_consumed_by_format
if match[1] is None:
TypeError: unexpected return RPC `read_setup`; innner message: '_sre.SRE_Match' object is not subscriptable; format: <8X
I believe this is due to how Python changed the behavior of re.match() in Python 3.6. Just wanted you to be aware as I don't think the pip-installed greatfet module enforces that version to be used.
I just made a local fix by updating match[1]
to match.groups(1)
and all seems to be working fine now.
Thanks for supporting such a cool project!
See greatscottgadgets/hackrf#1052 and greatscottgadgets/hackrf#1081.
If this request is not correctly handled the data toggles on host and device can end up out of sync.
Executing greatfet info
results in error:
File "/usr/local/bin/greatfet_info", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/greatfet/commands/greatfet_info.py", line 94, in main
devices = GreatFET(find_all=True)
File "/usr/local/lib/python2.7/dist-packages/greatfet/greatfet.py", line 29, in GreatFET
return GreatFETBoard.autodetect_all(**board_identifiers)
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 105, in autodetect_all
subclass_devices = subclass.all_accepted_devices(**device_identifiers)
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 151, in all_accepted_devices
if cls.accepts_connected_device(**identifiers):
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 168, in accepts_connected_device
potential_device = cls(**device_identifiers)
File "/usr/local/lib/python2.7/dist-packages/greatfet/boards/rad1o.py", line 24, in __init__
super(Rad1oBadge, self).__init__(**device_identifiers)
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 245, in __init__
if self.HANDLED_BOARD_IDS and (self.board_id() not in self.HANDLED_BOARD_IDS):
File "/usr/local/lib/python2.7/dist-packages/pygreat/board.py", line 274, in board_id
return self.apis.core.read_board_id()
File "/usr/local/lib/python2.7/dist-packages/pygreat/comms.py", line 1088, in method
timeout=timeout, max_response_length=max_response_length, encoding=encoding, *arguments)
File "/usr/local/lib/python2.7/dist-packages/pygreat/comms.py", line 1243, in execute_command
out_format, *arguments, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygreat/comms.py", line 761, in execute_command
None, max_response_length, comms_timeout, pretty_name, rephrase_errors)
File "/usr/local/lib/python2.7/dist-packages/pygreat/comms_backends/usb.py", line 288, in execute_raw_command
return response.tobytes()
AttributeError: 'array.array' object has no attribute 'tobytes'
System info:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.