panda: error in panda.flash_release()

Need to reflash my panda white. Using panda.flash_release() does this:

Using panda with serial XXX
Fetching latest firmware from github.com/commaai/panda-artifacts
Fetching firmware from https://github.com/commaai/panda-artifacts/raw/master/panda-v1.7.3-DEV-d034f3e9-RELEASE.zip
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.7/site-packages/panda/flash_release.py", line 32, in flash_release
    path = io.StringIO(r.content)
TypeError: initial_value must be str or None, not bytes

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Finally someone is figuring out this issue! My panda has been BROKEN for 6 months ever since I tried to update using curl.

Ok, that seems to have worked. Download an old image from https://github.com/commaai/panda-artifacts and then run this pointing to the firmware zip file, but running the current (i.e. fixed) branch:

sudo -E python3 -c "import panda; panda.flash_release('/home/balt/Downloads/panda-v1.5.2-DEV-736c2cbf-RELEASE.zip')"

and yes for some reason I still need to sudo this, even though I’ve installed the udev rules.

Why are you discontinuing wifi support? That’s a pretty major feature deprecation making the panda unusable with logger software on iPhone.

Looks like a sudo was missing and now it works. HOWEVER: The flashed version now only offers a BROKEN wifi identifier and the while connecting to the pairing wifi works, the subsequent attempt to connect to the BROKEN wifi does not. The password appears to be different.

So the question now is how to flash a non-broken version!?

balt@phoenix:~/panda$ sudo -E python3 -c "import panda; panda.flash_release()"
Fetching latest firmware from github.com/commaai/panda-artifacts
Fetching firmware from https://github.com/commaai/panda-artifacts/raw/master/panda-v1.7.3-DEV-d034f3e9-RELEASE.zip
File Name                                             Modified             Size
bootstub.panda.bin                             2020-02-05 11:47:44        13348
panda.bin                                      2020-02-05 11:47:44        34088
user1.bin                                      2020-02-05 11:47:46       248212
user2.bin                                      2020-02-05 11:47:46       248212
boot_v1.5.bin                                  2016-05-20 16:53:08         3232
version                                        2020-02-05 11:47:48           27
0. Preparing to flash v1.7.3-DEV-d034f3e9-RELEASE
1. Entering DFU mode
opening device 340059000e51363338383037 0xddcc
connected
opening device 340059000e51363338383037 0xddee
connected
2. Programming bootstub
programming 0 with length 2048
programming 1 with length 2048
programming 2 with length 2048
programming 3 with length 2048
programming 4 with length 2048
programming 5 with length 2048
programming 6 with length 2048
3. Flashing main code
opening device 340059000e51363338383037 0xddee
connected
flash: main version is v1.7.3-DEV-d034f3e9-RELEASE
flash: bootstub version is v1.7.3-DEV-d034f3e9-RELEASE
flash: unlocking
flash: erasing
flash: flashing
flash: resetting
opening device 340059000e51363338383037 0xddcc
connected
4. Verifying version
opening device 340059000e51363338383037 0xddcc
connected
dongle id: 3d20691fdb0857ff
v1.7.3-DEV-d034f3e9-RELEASE should be v1.7.3-DEV-d034f3e9-RELEASE
6. Success!

Ok, so I’ve reinstalled this laptop to Ubuntu 20.04 LTS.

balt@phoenix:~$ python3 -V
Python 3.8.2

installed pip3: sudo apt install python3-pip cloned panda: git clone https://github.com/commaai/panda.git

installed panda using pip3 from the cloned directory:

balt@phoenix:~/panda$ pip3 install ./
Processing /home/balt/panda
Collecting hexdump>=3.3
  Using cached hexdump-3.3.zip (12 kB)
Collecting libusb1==1.6.6
  Using cached libusb1-1.6.6.tar.gz (56 kB)
Collecting pycryptodome>=3.9.8
  Downloading pycryptodome-3.9.8-cp38-cp38-manylinux1_x86_64.whl (13.7 MB)
     |████████████████████████████████| 13.7 MB 4.8 MB/s 
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from pandacan==0.0.9) (2.22.0)
Collecting tqdm>=4.14.0
  Downloading tqdm-4.50.0-py2.py3-none-any.whl (70 kB)
     |████████████████████████████████| 70 kB 1.5 MB/s 
Building wheels for collected packages: pandacan, hexdump, libusb1
  Building wheel for pandacan (setup.py) ... done
  Created wheel for pandacan: filename=pandacan-0.0.9-py2.py3-none-any.whl size=21020 sha256=08423e7bf208ad87deb06cf2bae61d84f762eeff926613a89c2f2c5f0163d157
  Stored in directory: /tmp/pip-ephem-wheel-cache-7asakmi5/wheels/c1/ee/28/7ed8fdac6ae14e73a3a4ca427aea7a6a644190fd75ee46c149
  Building wheel for hexdump (setup.py) ... done
  Created wheel for hexdump: filename=hexdump-3.3-py3-none-any.whl size=8911 sha256=1d389d76d40b96bab71b4cb271b974932b56e3230ae4fdbc066c07f77a605b07
  Stored in directory: /home/balt/.cache/pip/wheels/7f/b7/72/1cc327e831ffef71bca1b0ca5e40b68471875f740ec9270c0f
  Building wheel for libusb1 (setup.py) ... done
  Created wheel for libusb1: filename=libusb1-1.6.6-py3-none-any.whl size=58455 sha256=2dec426aecd09520483030abff5cf525723994a19595da9db4f7fba2a833d9d6
  Stored in directory: /home/balt/.cache/pip/wheels/7d/a3/06/06165ef360de4bf75a47eae768f9e640557ac20b7cae2a1be9
Successfully built pandacan hexdump libusb1
Installing collected packages: hexdump, libusb1, pycryptodome, tqdm, pandacan
  WARNING: The script tqdm is installed in '/home/balt/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed hexdump-3.3 libusb1-1.6.6 pandacan-0.0.9 pycryptodome-3.9.8 tqdm-4.50.0

plugged in my panda+paw:

balt@phoenix:~/panda$ lsusb
Bus 002 Device 002: ID 0bda:0411 Realtek Semiconductor Corp. 4-Port USB 3.0 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 04f2:b580 Chicony Electronics Co., Ltd HD WebCam
Bus 001 Device 004: ID 2386:3115 Raydium Corporation Raydium Touch System
Bus 001 Device 003: ID 0489:e09f Foxconn / Hon Hai 
Bus 001 Device 006: ID bbaa:ddcc  
Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and trying to flash it to the release:

balt@phoenix:~/panda$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import panda
>>> panda.flash_release()
Fetching latest firmware from github.com/commaai/panda-artifacts
Fetching firmware from https://github.com/commaai/panda-artifacts/raw/master/panda-v1.7.3-DEV-d034f3e9-RELEASE.zip
File Name                                             Modified             Size
bootstub.panda.bin                             2020-02-05 11:47:44        13348
panda.bin                                      2020-02-05 11:47:44        34088
user1.bin                                      2020-02-05 11:47:46       248212
user2.bin                                      2020-02-05 11:47:46       248212
boot_v1.5.bin                                  2016-05-20 16:53:08         3232
version                                        2020-02-05 11:47:48           27
0. Preparing to flash v1.7.3-DEV-d034f3e9-RELEASE
1. Entering DFU mode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/balt/.local/lib/python3.8/site-packages/panda/flash_release.py", line 45, in flash_release
    panda = Panda(st_serial)
  File "/home/balt/.local/lib/python3.8/site-packages/panda/__init__.py", line 157, in __init__
    self.connect(claim)
  File "/home/balt/.local/lib/python3.8/site-packages/panda/__init__.py", line 203, in connect
    assert(self._handle is not None)
AssertionError
>>> 

Any help getting this to work is greatly appreciated!