Make plugnburn/edl work again with recent Python versions and Cat B35#2
Open
am97 wants to merge 2 commits intoplugnburn:masterfrom
Open
Make plugnburn/edl work again with recent Python versions and Cat B35#2am97 wants to merge 2 commits intoplugnburn:masterfrom
am97 wants to merge 2 commits intoplugnburn:masterfrom
Conversation
pyusb 1.1.0 does not work on newer Python versions.
For example, with Python 3.10 and Cat B35, I got the following:
am@Host-002:~/github/edl$ python edl.py -loader 0x000940e100000000.mbn -printgpt
Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.
Using loader 0x000940e100000000.mbn ...
Waiting for the device
Device detected :)
Mode detected: Sahara
------------------------
HWID: 0x000940e100000000 (MSM_ID:0x000940e1,OEM_ID:0x0000,MODEL_ID:0x0000)
PK_HASH: 0xcc3153a80293939b90d02d3bf8b23e0292e452fef662c74998421adad42a380f
Serial: 0x0fd85d74
SBL Version: 0x00000000
Successfully uploaded programmer :)
Traceback (most recent call last):
File "/home/am/.local/lib/python3.10/site-packages/usb/_interop.py", line 94, in as_array
return array.array('B', data)
TypeError: cannot use a str to initialize an array with typecode 'B'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/am/github/edl/edl.py", line 419, in <module>
main()
File "/home/am/github/edl/edl.py", line 191, in main
info=fh.connect(0)
File "/home/am/github/edl/Library/firehose.py", line 340, in connect
rsp=self.xmlsend(data)
File "/home/am/github/edl/Library/firehose.py", line 66, in xmlsend
self.cdc.write(data,self.cfg.MaxXMLSizeInBytes)
File "/home/am/github/edl/Library/usb.py", line 61, in write
self.device.write(self.EP_OUT,command[pos:pos+pktsize])
File "/home/am/.local/lib/python3.10/site-packages/usb/core.py", line 981, in write
_interop.as_array(data),
File "/home/am/.local/lib/python3.10/site-packages/usb/_interop.py", line 99, in as_array
a.fromstring(data) # deprecated since 3.2
AttributeError: 'array.array' object has no attribute 'fromstring'
Since the merge of plugnburn#1 this project no longer works on Cat B35. This commit adds a '-non-standard-responses' option, false by default (restores the behavior before the PR). KaiOS Nokias / Alcatel Cingular Flip should still work by toggling '-non-standard-responses'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The firts commit updates pyusb to version 1.2.1 in order to support newer Python versions (tested with Python 3.10)
The second commit fixes a regression from #1 for Cat B35. KaiOS Nokias / Alcatel Cingular Flip should still work by toggling '-non-standard-responses'
For the record, this is what I get with the first commit and without the second: