Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dfu.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _get_status(self):
data = self._in_request(self.DFU_GETSTATUS, 6)

status = data[0]
timeout = data[1] + data[2] << 8 + data[3] << 16
timeout = data[1] + (data[2] << 8) + (data[3] << 16)
state = data[4]
status_description = data[5] # index of status description in string table

Expand Down Expand Up @@ -227,5 +227,3 @@ def main(download, revertfactory):

if __name__ == '__main__':
main()


2 changes: 0 additions & 2 deletions dfu_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,3 @@ def main(download, revertfactory):

if __name__ == '__main__':
main()


14 changes: 7 additions & 7 deletions tuning.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import struct
import usb.core
Expand All @@ -12,8 +14,6 @@
NAME VALUE set the parameter with the NAME and the VALUE
"""



# parameter list
# name: (id, offset, type, max, min , r/w, info)
PARAMETERS = {
Expand Down Expand Up @@ -106,7 +106,7 @@ def read(self, name):
usb.util.CTRL_IN | usb.util.CTRL_TYPE_VENDOR | usb.util.CTRL_RECIPIENT_DEVICE,
0, cmd, id, length, self.TIMEOUT)

response = struct.unpack(b'ii', response.tostring())
response = struct.unpack(b'ii', response.tobytes())

if data[2] == 'int':
result = response[0]
Expand Down Expand Up @@ -155,7 +155,6 @@ def find(vid=0x2886, pid=0x0018):
return Tuning(dev)



def main():
if len(sys.argv) > 1:
if sys.argv[1] == '-p':
Expand All @@ -165,7 +164,7 @@ def main():
data = PARAMETERS[name]
print('{:16}\t{}'.format(name, '\t'.join([str(i) for i in data[2:7]])))
for extra in data[7:]:
print('{}{}'.format(' '*60, extra))
print('{}{}'.format(' ' * 60, extra))
else:
dev = find()
if not dev:
Expand All @@ -184,7 +183,7 @@ def main():
if name in PARAMETERS:
if len(sys.argv) > 2:
dev.write(name, sys.argv[2])

print('{}: {}'.format(name, dev.read(name)))
else:
print('{} is not a valid name'.format(name))
Expand All @@ -193,5 +192,6 @@ def main():
else:
print(USAGE.format(sys.argv[0]))


if __name__ == '__main__':
main()