[Testers Needed] GD-77 Firmware Loader for Linux and OS-X

KC7RBW
Posts: 159
Joined: Wed Nov 20, 2019 1:23 am

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by KC7RBW » Mon Dec 02, 2019 4:00 am

F1RMB wrote:
Sun Dec 01, 2019 4:59 pm
Well, it took me 8 hours to install mono-complete on a RPi 3 A+ :-D

Replace the udev rules file with the attached one, then execute the following (or reboot):

sudo udevadm control --reload-rules

Cheers.
Yikes. 8 hours is a long time. Possibly a faster MicroSD would work better. I'm sure it didn't take me that long.

I tried the rules file you sent, and it didn't work either, but this time I found where the logs went.

Code: Select all

Dec 01 19:30:26 pi systemd-udevd[12613]: Process '/bin/bash -c 'ID=$(echo /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/usbmisc/hiddev0 | cut -d/ -f8); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'' failed with exit code 1.
Looking at what's going on there, I wonder if grabbing the third in from the end would work better than grabbing the 7th or 8th depending on platform. You can do this using cut by using rev before and after. The following rule worked for me. If it works on non-Rasbian installations that would be great. I don't know what $devpath is on other Linuxes, but you may.

Code: Select all

KERNEL=="hiddev*", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="0666", GROUP="plugdev", RUN+="/bin/bash -c 'ID=$(echo %p | rev | cut -d/ -f3 | rev); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'"
I also tried to find a better way, but I haven't found it yet.

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by VK3KYY » Mon Dec 02, 2019 4:21 am

This is probably a stupid question, but why don't you just use the Python loader I wrote ?
I presume that would work on the RPi

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Mon Dec 02, 2019 5:05 am

Hi,
KC7RBW wrote:
Mon Dec 02, 2019 4:00 am
F1RMB wrote:
Sun Dec 01, 2019 4:59 pm
Well, it took me 8 hours to install mono-complete on a RPi 3 A+ :-D

Replace the udev rules file with the attached one, then execute the following (or reboot):

sudo udevadm control --reload-rules

Cheers.
Yikes. 8 hours is a long time. Possibly a faster MicroSD would work better. I'm sure it didn't take me that long.

I tried the rules file you sent, and it didn't work either, but this time I found where the logs went.

Code: Select all

Dec 01 19:30:26 pi systemd-udevd[12613]: Process '/bin/bash -c 'ID=$(echo /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/usbmisc/hiddev0 | cut -d/ -f8); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'' failed with exit code 1.
Looking at what's going on there, I wonder if grabbing the third in from the end would work better than grabbing the 7th or 8th depending on platform. You can do this using cut by using rev before and after. The following rule worked for me. If it works on non-Rasbian installations that would be great. I don't know what $devpath is on other Linuxes, but you may.

Code: Select all

KERNEL=="hiddev*", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="0666", GROUP="plugdev", RUN+="/bin/bash -c 'ID=$(echo %p | rev | cut -d/ -f3 | rev); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'"
I also tried to find a better way, but I haven't found it yet.
Okay. I guess you're using a RPi 4, beast I don't own. Yep, reversing should work regardless platforms.

So, are you able to flash your GD now ?

Cheers.
---
Daniel

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by VK3KYY » Mon Dec 02, 2019 5:37 am

I have a Rpi 4 but not really any time to test this.

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Mon Dec 02, 2019 5:44 am

F1RMB wrote:
Mon Dec 02, 2019 5:05 am
Hi,
KC7RBW wrote:
Mon Dec 02, 2019 4:00 am
F1RMB wrote:
Sun Dec 01, 2019 4:59 pm
Well, it took me 8 hours to install mono-complete on a RPi 3 A+ :-D

Replace the udev rules file with the attached one, then execute the following (or reboot):

sudo udevadm control --reload-rules

Cheers.
Yikes. 8 hours is a long time. Possibly a faster MicroSD would work better. I'm sure it didn't take me that long.

I tried the rules file you sent, and it didn't work either, but this time I found where the logs went.

Code: Select all

Dec 01 19:30:26 pi systemd-udevd[12613]: Process '/bin/bash -c 'ID=$(echo /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/usbmisc/hiddev0 | cut -d/ -f8); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'' failed with exit code 1.
Looking at what's going on there, I wonder if grabbing the third in from the end would work better than grabbing the 7th or 8th depending on platform. You can do this using cut by using rev before and after. The following rule worked for me. If it works on non-Rasbian installations that would be great. I don't know what $devpath is on other Linuxes, but you may.

Code: Select all

KERNEL=="hiddev*", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="0666", GROUP="plugdev", RUN+="/bin/bash -c 'ID=$(echo %p | rev | cut -d/ -f3 | rev); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'"
I also tried to find a better way, but I haven't found it yet.
Okay. I guess you're using a RPi 4, beast I don't own. Yep, reversing should work regardless platforms.

So, are you able to flash your GD now ?

Cheers.
---
Daniel
Try with this line as replacement:

Code: Select all

KERNEL=="hiddev*", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="0666", GROUP="plugdev", RUN+="/bin/bash -c 'ID=$(IFS=/; read -a array <<< %p; echo ${array[-3]}); echo $ID > /sys/bus/usb/drivers/usbhid/unbind'"

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Mon Dec 02, 2019 5:47 am

Hi Roger,
VK3KYY wrote:
Mon Dec 02, 2019 4:21 am
This is probably a stupid question, but why don't you just use the Python loader I wrote ?
I presume that would work on the RPi
That was the first thing I tried under Linux. I fixed and extended a bit the python script, it flash ATM, but the GD won't boot after that.
I need to check why (probably mistake from my side).
Attachments
gd-77_firmware_loader.py.zip
(3.18 KiB) Downloaded 167 times

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Mon Dec 02, 2019 5:51 am

Roger,
VK3KYY wrote:
Mon Dec 02, 2019 5:37 am
I have a Rpi 4 but not really any time to test this.
Yeah, no problem ;-)

Since Andrew idea to use the last third field from the end, that should work (hopefully) for all Linux platforms.

Cheers.
---
Daniel

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Mon Dec 02, 2019 5:46 pm

Hi Roger,
F1RMB wrote:
Mon Dec 02, 2019 5:47 am
Hi Roger,
VK3KYY wrote:
Mon Dec 02, 2019 4:21 am
This is probably a stupid question, but why don't you just use the Python loader I wrote ?
I presume that would work on the RPi
That was the first thing I tried under Linux. I fixed and extended a bit the python script, it flash ATM, but the GD won't boot after that.
I need to check why (probably mistake from my side).
Here is a working version of the python loader.

The PR has also been created.

EDIT: updated the attachement with a version that works with python2 and python3


Cheers.
---
Daniel
Attachments
gd-77_firmware_loader.py.zip
(4.07 KiB) Downloaded 177 times

KC7RBW
Posts: 159
Joined: Wed Nov 20, 2019 1:23 am

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by KC7RBW » Tue Dec 03, 2019 3:41 pm

Python loader worked nicely for me too, and didn't need to unbind the HID driver, though it did (without any udev rules) require root on the box I tested it on. I think that probably this means that we don't actually need to unbind the HID driver, but need to point the .NET loader at a different device node.

User avatar
F1RMB
Posts: 2608
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: [Testers Needed] GD-77 Firmware Loader for Linux and OS-X

Post by F1RMB » Tue Dec 03, 2019 5:20 pm

KC7RBW wrote:
Tue Dec 03, 2019 3:41 pm
Python loader worked nicely for me too, and didn't need to unbind the HID driver, though it did (without any udev rules) require root on the box I tested it on. I think that probably this means that we don't actually need to unbind the HID driver, but need to point the .NET loader at a different device node.
Nice to read that :-)

About unbinding, if I can succeed to make the CPS working with Mono, firmware flashing from within the CPS will require usbhid unbind. Codeplug reading/writing, with OpenGD77 will work as is, without unbinding, since it access it using a CDC ACM device. About official firmware, that will also require unbinding.

Cheers.
---
Daniel

Post Reply