Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
11a38d5d
Commit
11a38d5d
authored
6 years ago
by
roland
Committed by
Damien George
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tools/pydfu.py: Make the DFU tool work again with Python 2.
This patch will work for both Python 2 and 3.
parent
434975de
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/pydfu.py
+5
-1
5 additions, 1 deletion
tools/pydfu.py
with
5 additions
and
1 deletion
tools/pydfu.py
+
5
−
1
View file @
11a38d5d
...
@@ -61,8 +61,12 @@ __verbose = None
...
@@ -61,8 +61,12 @@ __verbose = None
# USB DFU interface
# USB DFU interface
__DFU_INTERFACE
=
0
__DFU_INTERFACE
=
0
# Python 3 deprecated getargspec in favour of getfullargspec, but
# Python 2 doesn't have the latter, so detect which one to use
import
inspect
import
inspect
if
'
length
'
in
inspect
.
getfullargspec
(
usb
.
util
.
get_string
).
args
:
getargspec
=
getattr
(
inspect
,
'
getfullargspec
'
,
inspect
.
getargspec
)
if
'
length
'
in
getargspec
(
usb
.
util
.
get_string
).
args
:
# PyUSB 1.0.0.b1 has the length argument
# PyUSB 1.0.0.b1 has the length argument
def
get_string
(
dev
,
index
):
def
get_string
(
dev
,
index
):
return
usb
.
util
.
get_string
(
dev
,
255
,
index
)
return
usb
.
util
.
get_string
(
dev
,
255
,
index
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment