dalefarnsworth-dmr / dmrRadio

GNU General Public License v3.0
4 stars 1 forks source link

Error Writing Codeplug #3

Closed WebbyMD1 closed 3 years ago

WebbyMD1 commented 3 years ago

I have tried using dmrRadio on a Raspberry Pi connected to both an MD-380 and an MD-UV380, and in both cases the codeplug write doesn't work/complete because of a panic/runtime error. The output of dmrRadio is as follows:

Preparing to write codeplug... 100% Writing codeplug to radio.... 100% panic: runtime error: index out of range

goroutine 1 [running]: main.progressCallback.func1(0x0, 0x1, 0x149bf88) /root/go/src/github.com/DaleFarnsworth-DMR/dmrRadio/main.go:136 +0x1b0 github.com/dalefarnsworth-dmr/codeplug.(Codeplug).WriteRadio.func1(0x0, 0x149bf88, 0x6) /root/go/src/github.com/dalefarnsworth-dmr/codeplug/codeplug.go:2342 +0x24 github.com/dalefarnsworth-dmr/dfu.(Dfu).setMaxProgressCount(0x18cfa00, 0x340) /root/go/src/github.com/dalefarnsworth-dmr/dfu/dfu.go:842 +0xc8 github.com/dalefarnsworth-dmr/dfu.(Dfu).writeFlashFrom(0x18cfa00, 0x0, 0xd0000, 0x493020, 0x147d260, 0x1, 0x18d5eac) /root/go/src/github.com/dalefarnsworth-dmr/dfu/dfu.go:973 +0x24c github.com/dalefarnsworth-dmr/dfu.(Dfu).WriteCodeplug(0x18cfa00, 0x1620225, 0xd0000, 0xd0010, 0xe, 0x0) /root/go/src/github.com/dalefarnsworth-dmr/dfu/dfu.go:1218 +0x6c github.com/dalefarnsworth-dmr/codeplug.(*Codeplug).WriteRadio(0x14b40a0, 0x18cea20, 0x0, 0x0) /root/go/src/github.com/dalefarnsworth-dmr/codeplug/codeplug.go:2349 +0x364 main.writeCodeplug(0x3a6140, 0x1443fa8) /root/go/src/github.com/DaleFarnsworth-DMR/dmrRadio/main.go:295 +0x170 main.main() /root/go/src/github.com/DaleFarnsworth-DMR/dmrRadio/main.go:848 +0x68c

I have tried this with both codeplugs read back from radios, reference codeplugs from the internet and by using "dmrRadio newCodeplug".

WebbyMD1 commented 3 years ago

Additional information: go version go1.11.6 linux/arm And OS is: Raspbian 10 (buster)

The radio does get put in to "PC Program USB Mode" and the terminal does say that the codeplug was written to the radio 100% but then immediately panics. The uploaded codeplug is not in the radio when I power cycle it. This is replicated across different MD-380 radios and MD-UV380 radios.

I have now tried the same on an Ubuntu 20.04 desktop machine and find the same problem showing that this is not Raspberry Pi or Arm specific.

I am not experienced with Golang, but I built dmrRadio by doing the following. I added ~/go/bin to my path. I added ~/go as my GOHOME. At the command prompt I then did a 'go get github.com/DaleFarnsworth-DMR/dmrRadio' and the source code and dependancies were pulled down on my behalf and the binary built and put in the bin folder.

DaleFarnsworth commented 3 years ago

I've reproduced the bug and yes, embarrassingly, it does happen every time. The resulting codeplug in the radio is corrupted. Fortunately, editcp writes the codeplug correctly.

I also see some of these messages prior to the panic: dmrRadio: libusb.go:191: handle_events: error: libusb: interrupted [code -10] dmrRadio: libusb.go:191: handle_events: error: libusb: interrupted [code -10] dmrRadio: libusb.go:191: handle_events: error: libusb: interrupted [code -10]

DaleFarnsworth commented 3 years ago

Fixed in version 1.0.25. Thank you very much for the bug report.