python gd-77_firmware_loader mods for mac

Discussions related to the firmware code development
OH1E
Posts: 96
Joined: Sat Nov 16, 2019 8:59 am

python gd-77_firmware_loader mods for mac

Post by OH1E » Sat Apr 11, 2020 8:16 am

As MacOSX cannot use usblib, it need use hidapi library instead, is there any easy way to do this modification?
source https://stackoverflow.com/questions/257 ... r-mac-os-x

import hid

hidraw = hid.device(0x15a2, 0x1010)
hidraw.open(0x15a2, 0x1010)
hidraw.send_feature_report([0x00, 0x00, 0x00,0x00,0x00,0x00,0x00,0x00])

something like this..

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Sat Apr 11, 2020 8:48 am

Hi,
Riku wrote:
Sat Apr 11, 2020 8:16 am
As MacOSX cannot use usblib, it need use hidapi library instead, is there any easy way to do this modification?
source https://stackoverflow.com/questions/257 ... r-mac-os-x

import hid

hidraw = hid.device(0x15a2, 0x1010)
hidraw.open(0x15a2, 0x1010)
hidraw.send_feature_report([0x00, 0x00, 0x00,0x00,0x00,0x00,0x00,0x00])

something like this..
Looking at this, it seems there are few solutions, like hid from PyPI, cython-hidapi, etc.
Which one is the easiest to install on OS X ?


Cheers.
---
Daniel

OH1E
Posts: 96
Joined: Sat Nov 16, 2019 8:59 am

Re: python gd-77_firmware_loader mods for mac

Post by OH1E » Sat Apr 11, 2020 12:30 pm

hidapi went with pip on osx.
according this: https://github.com/signal11/hidapi it is compatible with other os aswell windows linux

% pip install hidapi
Collecting hidapi
Downloading hidapi-0.9.0.post2.tar.gz (55 kB)
|████████████████████████████████| 55 kB 755 kB/s
Requirement already satisfied: setuptools>=19.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from hidapi) (41.2.0)
Installing collected packages: hidapi
Running setup.py install for hidapi ... done
Successfully installed hidapi-0.9.0.post2

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Sat Apr 11, 2020 1:08 pm

Riku wrote:
Sat Apr 11, 2020 12:30 pm
hidapi went with pip on osx.
according this: https://github.com/signal11/hidapi it is compatible with other os aswell windows linux

% pip install hidapi
Collecting hidapi
Downloading hidapi-0.9.0.post2.tar.gz (55 kB)
|████████████████████████████████| 55 kB 755 kB/s
Requirement already satisfied: setuptools>=19.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from hidapi) (41.2.0)
Installing collected packages: hidapi
Running setup.py install for hidapi ... done
Successfully installed hidapi-0.9.0.post2
Okay. I will try to use it, it would be great to have a single script for all platforms.


Cheers.
---
Daniel

OH1E
Posts: 96
Joined: Sat Nov 16, 2019 8:59 am

Re: python gd-77_firmware_loader mods for mac

Post by OH1E » Sun Apr 12, 2020 11:24 am

yeah would be nice, not to start windows machine every time just for upgrading firmware. as been using now long time hackintosh pc :DD

Mono wont work so... only option is this python script. also cps is a problem on unix system like linux/osx but one thing at the time :)

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Wed Apr 15, 2020 7:41 am

Hi,

Expect a test version today ;-)

Cheers.
---
Daniel

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Wed Apr 15, 2020 8:48 am

Hi,

Here is a version that implements hidapi support.

To run it under Linux, install the according package (under Debian/Ubuntu like, it's python-hidapi for Python 2.7, or python3-hidapi for Python 3.x).
Under Windows, some extra steps are needed (it's written at the top of the Python file):

Code: Select all

# Windows (tested with Python 3.8):
#  - Download hidapi-win.zip from https://github.com/libusb/hidapi/releases
#      * unzip
#      * copy hidapi.dll to C:\Windows\System32
#
#  - Download Cython interface to the hidapi from https://pypi.org/project/hidapi/#files (take care to get matching Python version, "cpxx")
#      * once downloaded: python -m pip install hidapi-0.9.0.post2-cp38-cp38-win_amd64.whl  (filename must change according to version and platform)
#
#  - Install python modules:
#      * pip install urllib3 enum34
About OS-X, Riku, it would be great if you can provide the installation instruction, that way I could had them to the file header too.


Cheers.
---
Daniel
Attachments
gd-77_firmware_loader.py.zip
(6.51 KiB) Downloaded 190 times

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Sat Apr 18, 2020 11:12 am

Hi,

It seems Riku is busy, but I see few downloads. So, for the people who downloaded the script, could you report if it works for you or not ?


Cheers.
---
Daniel

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

Re: python gd-77_firmware_loader mods for mac

Post by VK3KYY » Sat Apr 18, 2020 11:26 am

If you want me to test this on a mac, I can try tomorrow.

I have a hackintosh and a real mac

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

Re: python gd-77_firmware_loader mods for mac

Post by F1RMB » Sat Apr 18, 2020 11:41 am

Hi Roger,
VK3KYY wrote:
Sat Apr 18, 2020 11:26 am
If you want me to test this on a mac, I can try tomorrow.

I have a hackintosh and a real mac
Okay, that's cool, I have it already in an incoming PR, but I wait for some feedback to pull the trigger ;)
BTW, the version I will push is a bit different, it contains the latest changes about the GD-77S filename, and few things, nothing critical.

Cheers.
---
Daniel

Post Reply