thorrak / brewflasher

Standalone firmware flasher for Brewing-related ESP8266/ESP32 firmware
Other
62 stars 8 forks source link

does not work on macOS M1 #35

Closed homonto closed 10 months ago

homonto commented 11 months ago

this file: https://github.com/thorrak/brewflasher/releases/download/v1.7.0/BrewFlasher-1.7.0.MacOS.pkg

does not run at all - it installs but the installed app, after double click on it, appears for 0.3s only and that is all

thegreatgunbantoad commented 11 months ago

Mac never plays well with others. I've never had breflasher work on mac, trying to get mac to reckonise devices they didn't make is a pain in the hole. What's your Mac OS version? Can you see the comms port?

thorrak commented 11 months ago

That's... frustrating, to say the least. @thegreatgunbantoad - are you using an M1 or an Intel-based mac?

I primarily develop on (and pay Apple to be part of their developer program so that I can release for) an M1 Mac, so everything should work.

If you go to Applications > Utilites > Console and look at either Log Reports, Crash Reports, or Diagnostic Reports, do you see anything pop up when you try to launch BrewFlasher? Typically, this is where you would see an error message if there was something wrong (either a crash, or a credential issue for example)

homonto commented 11 months ago

M1 is not intel ;-) MacBook Pro M1 16" 2022 I will have to download again to check it com port is ok, when I use platformio or Arduino all is ok: /dev/cu.* MacOS version 14.1.2

thegreatgunbantoad commented 11 months ago

@thorrak It was my missus macbook pro 2013. Also quite a way back last time I tried (maybe 2019). I've never gotten along with mac os though so I did give up pretty quickly. If I recall the only reason I tried is because my insider version of windows killed itself.

homonto commented 11 months ago
papio@mbp16m1papio ~ % /Applications/BrewFlasher.app/Contents/MacOS/BrewFlasher ; exit;
Main.py:39: DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead
Traceback (most recent call last):
  File "urllib3/connection.py", line 203, in _new_conn
  File "urllib3/util/connection.py", line 85, in create_connection
  File "urllib3/util/connection.py", line 73, in create_connection
OSError: [Errno 9] Bad file descriptor

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 791, in urlopen
  File "urllib3/connectionpool.py", line 492, in _make_request
  File "urllib3/connectionpool.py", line 468, in _make_request
  File "urllib3/connectionpool.py", line 1097, in _validate_conn
  File "urllib3/connection.py", line 611, in connect
  File "urllib3/connection.py", line 218, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x10688bb90>: Failed to establish a new connection: [Errno 9] Bad file descriptor

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "requests/adapters.py", line 486, in send
  File "urllib3/connectionpool.py", line 845, in urlopen
  File "urllib3/util/retry.py", line 515, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.brewflasher.com', port=443): Max retries exceeded with url: /firmware/api/project_list/all/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10688bb90>: Failed to establish a new connection: [Errno 9] Bad file descriptor'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Main.py", line 712, in OnInit
  File "Main.py", line 674, in __init__
  File "brewflasher_com_integration.py", line 305, in load_from_website
  File "brewflasher_com_integration.py", line 193, in load_projects_from_website
  File "requests/api.py", line 73, in get
  File "requests/api.py", line 59, in request
  File "requests/sessions.py", line 589, in request
  File "requests/sessions.py", line 703, in send
  File "requests/adapters.py", line 519, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.brewflasher.com', port=443): Max retries exceeded with url: /firmware/api/project_list/all/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10688bb90>: Failed to establish a new connection: [Errno 9] Bad file descriptor'))
OnInit returned false, exiting...

and:
<img width="700" alt="Screenshot 2023-12-04 at 20 22 33" src="https://github.com/thorrak/brewflasher/assets/46562447/5c92c2b3-cb5d-44cf-aa2c-8b6f885eaaaa">

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
homonto commented 11 months ago
Screenshot 2023-12-04 at 20 22 33
homonto commented 11 months ago

no other messages in logs on the Console

thorrak commented 11 months ago

Hmm. That’s the terminal - not the console.

Is that the issue? A firewall is preventing it from accessing the server to download the firmware list?

homonto commented 11 months ago

console showed completely nothing, application starts in the menu bar and disappears in 0.1s so I could only get anything while running in the terminal yes, firewall asks for permission but app dies before I am able to give the permission let me try without firewall then

thorrak commented 11 months ago

Hm. Alright. Let me try to figure out a way to test on my side.

@thegreatgunbantoad - Unfortunately, I’m not shocked that you were running into issues as that’s an Intel-based Mac. I don’t have an Intel-based Mac to build/sign with, so I’m entirely reliant on PyInstaller’s qemu emulation to get a fat binary. I thought I had it worked out with the latest version, but am not entirely shocked that it isn’t perfect.

thegreatgunbantoad commented 11 months ago

@thorrak it does (did at the time) run windows beautifully. Definately runs faster under Windows than MacOs that machine. I think they lock the speed in MacOs, adding an SSD did nothing at all to speed up MacOs which does suggest a cheecky bus speed lockout if you upgrade it yourself.

thegreatgunbantoad commented 11 months ago

@thorrak from what I recall it looked like a driver thing, I could never see the port.

MikeTHIS commented 11 months ago

Hey all,

I have the same problem on an M1 (2020) Mac mini running Montery 12.4 (currently I have to update).

I downloaded an older version and it worked fine, programmed an ESP32 and everything.

I know this Is being worked on but just wanted to let you know I was having a problem also @thorrak - thanks for the great work with this! I looked for you on Instagram to tag you there on a post I had made but didn't see you there. :)

jsemroc commented 10 months ago

FWIW, I've found that I can get 1.7.0 running on my M1 MacBook Pro (13.6.3) as well as a M2 MacBook Air (14.2)

  1. Open the Applications directory
  2. Locate the BrewFlasher application
  3. Right-click on the BrewFlasher app and choose 'Show Package Contents'
  4. Open the Contents directory
  5. Open the MacOS directory
  6. Double-click the BrewFlasher executable file. This causes a terminal window to open and BrewFlasher-1.7.0 opens.
  7. After you quite BrewFlasher you will need to close the terminal session window.

[Update] You can also open a Terminal window on the Mac and execute the command:

open /Applications/BrewFlasher.app

thorrak commented 10 months ago

I apologize for the radio silence on my end -- we had a death in the family a few weeks ago, and between that and the holidays it was only today that I finally got some time to look into this.

The issue here is actually a strange edge case where when the frozen app is run from the bundle (the .app file with the icon) attempting to detect the user's language setting in the way I do for Windows triggers an error which then causes BrewFlasher to instead try to use Apple's preferred mechanism for detecting language. This relies on a package called pyobjc which - unfortunately - I neglected to bundle with the latest version of BrewFlasher. By contrast, launching the terminal app directly enables the Windows language detection to work, which skips the Apple-specific code requiring this package.

I've gone ahead and rebuilt BrewFlasher, but including this package which seems to have resolved the error. I will release this momentarily as v1.7.1 (but will not do a full release - I will instead just replace the MacOS v1.7.0 binaries in the 1.7.0 release).

To hopefully prevent this issue going forward I have also tried to tweak my build scripts to call out the need to install this package, and (hopefully) raise errors if this package is not installed. I have also made the "Apple-specific" language detection code the default when running on MacOS.

thorrak commented 10 months ago

v1.7.1 is now available here: https://github.com/thorrak/brewflasher/releases/tag/v1.7.0

Thank you again for reporting this, and sorry for the delay in resolving it!

jsemroc commented 10 months ago

No apologies required. Thank you for providing this valuable tool. Jeff SemrocOn Dec 24, 2023, at 4:21 PM, John @.***> wrote: v1.7.1 is now available here: https://github.com/thorrak/brewflasher/releases/tag/v1.7.0 Thank you again for reporting this, and sorry for the delay in resolving it!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

thegreatgunbantoad commented 10 months ago

@thorrak as @jsemroc said no need to appologise ever, even had it not been for those circumstances. As said many thanks for providing and maintaing this tool. Doing these updates whilst having to deal with what happened is way over and above the call. Thank you very much, you are a legend! I can't quite find the send me a beer (well donation to that effect) link in your app or github though, point me to it and one is coming your way.