10.01.2021, 13:53, "Arno Morbach" <a...@familie-morbach.de>:
> Hi,
>
> I don't know what you are going to do but the "rb" in front of the 
> "\xff{256}" seems odd. I only know of a "r" prefix.
>
> I would try: if re.match(r"\xff{256}", chunk):

Wrong observation, that's code from the fx2tool, not code from Kevin, as the 
traceback shows. The 'b' prefix is used in both Python2 and Python3 for 
different purposes, but it does, as a rule, point out that the 'string' in 
question needs to be interpreted as a collection of bytes and not something 
necessarily human-readable, interfacing with hardware would be a prime example 
of that. Specifically in Python3, it has way more meaning and is used to 
distinguish ASCII strings from Unicode strings, which is a very important 
distinction to make since Unicode strings are the default in Python3.

The b prefix is there for a reason (again, hardware interfacing), while 
removing it causes the SyntaxError to go away (at least, for this specific 
line), there's no guarantees it'll fix the actual problem and not just cause 
more problems - the code is Python3 to begin with. A quick REPL experiment 
shows that the "re.match(rb"\xff{256}", chunk)" line gives a SyntaxError on 
Python2, but works well on Python3, and the "#!/usr/bin/python3" shebang 
indicates that this is the right direction to go in, too.

Cheers!
Arsenijs

> Arno
> Am 08.01.2021 um 14:29 schrieb Fausto Barbosa:
>> Thank you Kevin for the fast response.
>>
>> This solution was very clever and promising but I got a frustrating error 
>> from fx2tool related to its syntax:
>> "
>> Traceback (most recent call last):
>>   File "/usr/local/bin/fx2tool", line 5, in <module>
>>     from fx2.fx2tool import main
>>   File "/usr/local/lib/python2.7/dist-packages/fx2/fx2tool.py", line 327
>>     if re.match(rb"\xff{256}", chunk):
>>                             ^
>> SyntaxError: invalid syntax
>> "
>> I didn't find any help on this on google.
>>
>> If you or someone else now how to run, in other program, the sequence of 
>> save the eeprom content, change the VID PID and reflash I would gratefully 
>> try it as well. Unfortunately this world of reading and writing firmwares to 
>> eeproms manually is kind of new to me.
>>
>> Thank you in advance.
>> Fausto.
>>
>> On Fri, Jan 8, 2021 at 6:41 AM Kevin Grant <elect...@mykolab.com> wrote:
>>> I don't think that VID PID pair is supported. It would be nice if PulseView 
>>> could let you add VID PID easily but I think it needs re-compile.
>>>
>>> You could change VID PID of your device to a supported one which is listed 
>>> here:
>>>
>>> src/hardware/fx2lafw/api.c
>>>
>>> https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=src/hardware/fx2lafw/api.c;h=5acb0016d0b8e6ab5ad204aea7e238f55e2f5fa8;hb=HEAD
>>>
>>> e.g. first option is 0x08a9, 0x0014
>>>
>>> You might be able to use the python fx2tool to change VID PID
>>>
>>> https://github.com/whitequark/libfx2
>>>
>>> pip install fx2
>>>
>>> fx2tool -B -d 16c0:296d read_eeprom -W 1 0 256
>>>
>>> fx2tool -B -d 16c0:296d read_eeprom -W 1 -f eeprom.bin 0 256 save copy of 
>>> eeprom.bin, modify VID PID, then:
>>>
>>> fx2tool -B -d 16c0:296d write_eeprom -W 1 -a 0 -f ./eeprom-new.bin 
>>> unplug/re-plug, should be new VID PID now Maybe someone knows easier way? 
>>> Rgds Kevin
>>>
>>> On 2021-01-08 01:03, Fausto Barbosa wrote:
>>>> Hi folks,
>>>>
>>>> I'm trying  to run geeetech CY7C68013A LA on sigrok/pulseview on ubuntu 
>>>> 18.04 but it is not being detected.
>>>> $ sudo sigrok-cli -d fx2lafw --scan
>>>> returns nothing (as superuser or normal user).
>>>>
>>>> dmesg returns:
>>>> [ 1712.183139] usb 1-3: new high-speed USB device number 7 using xhci_hcd
>>>> [ 1712.331431] usb 1-3: config 1 interface 0 altsetting 0 bulk endpoint 
>>>> 0x1 has invalid maxpacket 64
>>>> [ 1712.331826] usb 1-3: New USB device found, idVendor=16c0, 
>>>> idProduct=296d, bcdDevice=ff.ff
>>>> ...
>>>
>>> _______________________________________________
>>> sigrok-devel mailing list
>>> sigrok-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/sigrok-devel
>>
>> _______________________________________________ sigrok-devel mailing list 
>> sigrok-devel@lists.sourceforge.net 
>> https://lists.sourceforge.net/lists/listinfo/sigrok-devel
> ,,
>
> _______________________________________________
> sigrok-devel mailing list
> sigrok-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sigrok-devel


_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to