bengtmartensson / AGirs

A Girs infrared server for the Arduino
http://www.harctoolbox.org/Girs.html
GNU General Public License v2.0
55 stars 13 forks source link

Make mkflasher.sh compatible with macOS #54

Closed adrcunha closed 4 years ago

adrcunha commented 4 years ago

The original script is macOS compatible, just missing the correct location of avrdude.

This PR updates the script to point to the right location of avrdude on macOS, assuming Arduino IDE was installed in /Applications (the default location).

Tested manually on macOS Mojave with an Arduino UNO:

$ uname -a
Darwin macintosh.local 18.7.0 Darwin Kernel Version 18.7.0: Mon Feb 10 21:08:45 PST 2020; root:xnu-4903.278.28~1/RELEASE_X86_64 x86_64
$ ./GirsLite-1.0.2-nano-flasher.sh -n /dev/cu.usbmodem14101 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
...
avrdude: 11962 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

$
bengtmartensson commented 4 years ago

Thank you very much for the PR.

Possibly you want to submit another PR that sets up the default device for MacOS? Using something like

PORT=$(ls /dev/cu.usbmodem*)

should do it, I think.

adrcunha commented 4 years ago

Thank you very much for the PR.

Possibly you want to submit another PR that sets up the default device for MacOS? Using something like

PORT=$(ls /dev/cu.usbmodem*)

should do it, I think.

I'm not sure there's a safe pattern here. My Arduino UNO appears as /dev/cu.usbmodem1401, but my Arduino Nano appears as /dev/cu.usbserial-1410. Different docs around the Internet mention different variations of (cu|tty).(serial|usb)modem* as the right port(s). So, for simplicity sake, I decided to not change the default port or define it at runtime. But if I figure it out at some point I'll definitely send you a PR.

bengtmartensson commented 4 years ago

AFAIK, the cu/tty stuff was introduced in Solaris sometime in the nineties. If a modem was hanging on a serial line, the cu-form was used for dialing out, and the tty-version for dialing-in. There was some difference on how the modem control lines were used.

On MacOS, I have never noticed any difference. FWIW...