markqvist / rnodeconfigutil

MIT License
24 stars 11 forks source link

rnodeconfig --autoinstall issue with TBeam ESP32 - AttributeError: 'NoneType' object has no attribute 'device' #9

Closed HarlekinSimplex closed 2 years ago

HarlekinSimplex commented 2 years ago

Hi Mark,

by running the following command rnodeconf /dev/ttyACM0 --autoinstall

I get the following error:

Hello!

This guide will help you install the RNode firmware on supported
and homebrew devices. Please connect the device you wish to set
up now. Hit enter when it is connected.

Traceback (most recent call last):
  File "/home/pi/.local/bin/rnodeconf", line 10, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/rnodeconf/rnodeconf.py", line 913, in main
    if selected_port == None:
  File "/usr/lib/python3/dist-packages/serial/tools/list_ports_common.py", line 74, in __eq__
    return self.device == other.device
AttributeError: 'NoneType' object has no attribute 'device'

It looks like thats a problem with my RPi4, because that same TBeam can be programmed on my other RPi2B without any problems.

The devices look like:

xls -l /dev/ttyA*
crw-rw---- 1 root dialout 166,  0 Feb 19 02:29 /dev/ttyACM0
crw-rw---- 1 root dialout 204, 64 Feb 19 02:12 /dev/ttyAMA0

and the actual user like this:

id $USER
uid=1000(pi) gid=1000(pi) Gruppen=1000(pi),20(dialout),27(sudo),997(gpio)

After flashing the device with the other RPi2B and running rnodeconf /dev/ttyACM0 -u I get the following:

Leaving...
Hard resetting via RTS pin...
[2022-02-19 02:29:41] Flashing new firmware completed
[2022-02-19 02:29:41] Opening serial port /dev/ttyACM0...
[2022-02-19 02:29:43] Device connected
[2022-02-19 02:29:43] Current firmware version: 1.27
[2022-02-19 02:29:43] Reading EEPROM...
[2022-02-19 02:29:44] EEPROM checksum correct
[2022-02-19 02:29:44] Device signature validation failed

     WARNING! This device is NOT verifiable and should NOT be trusted.
     Someone could have added privacy-breaking or malicious code to it.

     Proceed at your own risk and responsibility! If you created this
     device yourself, please read the documentation on how to sign your
     device to avoid this warning.

     Always use a firmware downloaded as binaries or compiled from source
     from one of the following locations:

        https://unsigned.io/rnode
        https://github.com/markqvist/rnode_firmware

     You can reflash and bootstrap this device to a verifiable state
     by using this utility. It is recommended to do so NOW!

     To initialise this device to a verifiable state, please run:

              rnodeconf /dev/ttyACM0 --autoinstall

[2022-02-19 02:29:44] 
[2022-02-19 02:29:44] Firmware update completed successfully
[2022-02-19 02:29:44] 
[2022-02-19 02:29:44] Device info:
[2022-02-19 02:29:44]   Product            : LilyGO T-Beam 850 - 950 MHz (e0:e9:33)
[2022-02-19 02:29:44]   Device signature   : Unverified
[2022-02-19 02:29:44]   Firmware version   : 1.27
[2022-02-19 02:29:44]   Hardware revision  : 1
[2022-02-19 02:29:44]   Serial number      : 00:00:00:04
[2022-02-19 02:29:44]   Frequency range    : 850.0 MHz - 950.0 MHz
[2022-02-19 02:29:44]   Max TX power       : 17 dBm
[2022-02-19 02:29:44]   Manufactured       : 2022-02-18 18:27:01
[2022-02-19 02:29:44]   Device mode        : Normal (host-controlled)

However the device runs perfectly fine. But new devices I'm still unable to flash initially using my RPi4.

What is wrong here?

Cheers Stephan

markqvist commented 2 years ago

Interesting, thanks for reporting. I'll have to flash a fresh Pi 4 to check it out. Can you let me know what exact OS version you were using?

markqvist commented 2 years ago

This issue is caused by a bug in version 3.4 of pyserial that ships as the default version on some operating systems. The bug was fixed in pyserial 3.5. The next release of rnodeconf will require version 3.5 of pyserial, so it will be automatically updated.

For now, you can remedy the issue by simply updating pyserial: pip3 install pyserial --upgrade