Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remap msys2 usb, fix USB port detection #2301

Merged
merged 2 commits into from Feb 28, 2018

Conversation

Projects
None yet
4 participants
@nooges
Copy link
Contributor

commented Jan 25, 2018

  • Maps tty device in MSYS2 to correct COM port for use with avrdude. (Ex. /dev/ttyS2 -> /dev/COM3, /dev/ttyS0 -> /dev/COM1)
  • Fix detection of USB port
@drashna

This comment has been minimized.

Copy link
Member

commented Jan 25, 2018

Tested this out, it still errors out for me (MSYS2, Windows 10),

avrdude.exe: ser_open(): can't open device "/??/COM10": The filename, directory name, or volume label syntax is incorrect.

@nooges

This comment has been minimized.

Copy link
Contributor Author

commented Jan 26, 2018

@drashna Can you send me the output of /proc/version in your setup?

@drashna

This comment has been minimized.

Copy link
Member

commented Jan 26, 2018

/proc/version doesn't work for me.
However:
gcc.exe (Rev1, Built by MSYS2 project) 7.2.0
And it looks like "20161025" is the build date for it.

@nooges nooges force-pushed the nooges:remap-msys2-usb branch from a92ad2c to 6568412 Jan 29, 2018

@nooges

This comment has been minimized.

Copy link
Contributor Author

commented Jan 29, 2018

Okay, fixed things up

@nooges

This comment has been minimized.

Copy link
Contributor Author

commented Jan 31, 2018

@drashna Can you test this out again?

@drashna

This comment has been minimized.

Copy link
Member

commented Jan 31, 2018

np.
Now it errors out doing this:

Detecting USB port, reset your controller now.......
Detected controller on USB port at /dev/ttyS9
Remapped MSYS2 USB port to /dev/COM10
avrdude.exe: ser_open(): can't open device "C:/msys64/dev/COM10": The system cannot find the file specified.

avrdude.exe done. Thank you.

make[1]: *** [tmk_core/avr.mk:172: avrdude] Error 1

The COM port is correct (COM10), but ... the command is apparently prepending the MSYS path.

Also, just testing it, the AVRDUDE binary gets downloaded in such a way that only the MINGW64 command line works. The MSYS command line doesn't see the EXE.

@nooges

This comment has been minimized.

Copy link
Contributor Author

commented Jan 31, 2018

Yeah, the AVRDUDE binary is only available in the MINGW64 shell when installed via pacman. You might want to try updating your version of MSYS, most people I've talked to have this version in /proc/version:
MINGW64_NT-6.1 version 2.9.0(0.318/5/3) (Alexx@WARLOCK) (gcc version 6.3.0 (GCC) ) 2017-09-13 23:16

@drashna

This comment has been minimized.

Copy link
Member

commented Jan 31, 2018

Yeah, that's the version that I have.
Same behavior in both (and the copy of avrdude is the same, as well)

@nooges nooges force-pushed the nooges:remap-msys2-usb branch from 6568412 to 0a341b5 Feb 8, 2018

@@ -183,6 +183,10 @@ avrdude: $(BUILD_DIR)/$(TARGET).hex check-size
done; \
echo ""; \
echo "Detected controller on USB port at $$USB"; \
if grep -q -s 'MINGW\|MSYS' /proc/version; then \
USB=`echo "$$USB" | perl -pne 's/ttyS(\d+)/COM.($$1+1)/e'`; \

This comment has been minimized.

Copy link
@drashna

drashna Feb 14, 2018

Member

This fixes the flashing issue:

USB=`echo "COM"$$(($$(echo $$USB | sed -e 's/\/dev\/ttyS\([0-9]*\)/\1/g') + 1))`; \`

This comment has been minimized.

Copy link
@drashna

drashna Feb 14, 2018

Member

This would fix #2099

This comment has been minimized.

Copy link
@nooges

nooges Feb 14, 2018

Author Contributor

Cool, I'll test on my machine and make the change if it works.

This comment has been minimized.

Copy link
@drashna

drashna Feb 14, 2018

Member

Well, I tested if before posting it here, but please do make sure it works, as well!

This comment has been minimized.

Copy link
@Tiryoh

Tiryoh Feb 15, 2018

I also checked the script. It might work.
#2099 (comment)

@nooges nooges force-pushed the nooges:remap-msys2-usb branch from 0a341b5 to a196665 Feb 14, 2018

@drashna

This comment has been minimized.

Copy link
Member

commented Feb 15, 2018

Confirmed that these changes fix the issue with MSYS/Windows, and flash properly.

The only caveat now is that you have avrdude installed somewhere accessible.
It may be a good idea (eg, I have no idea how) to download the EXE for Windows (MinGW) and place it in the qmk_util directory with some of the other tools (like teensy_loader_cli.exe).

And it looks like the official source/site for that is:
http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3-mingw32.zip
(this is the version, and source mentioned in the avrdude binary included with the QMK toolkit, as well)

@jackhumbert

This comment has been minimized.

Copy link
Member

commented Feb 28, 2018

Awesome - thanks!

@jackhumbert jackhumbert merged commit 524053e into qmk:master Feb 28, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

jrolfs added a commit to jrolfs/qmk that referenced this pull request Mar 5, 2018

Remap msys2 usb, fix USB port detection (qmk#2301)
* Add AVRDUDE to MSYS2 setup

* Remap detected USB port in MSYS2 to COM port

@nooges nooges deleted the nooges:remap-msys2-usb branch Mar 23, 2018

@drashna drashna referenced this pull request Mar 25, 2018

Closed

Add support for avrdude #766

peel added a commit to peel/qmk_firmware that referenced this pull request Mar 28, 2018

Remap msys2 usb, fix USB port detection (qmk#2301)
* Add AVRDUDE to MSYS2 setup

* Remap detected USB port in MSYS2 to COM port

DanielGGordon added a commit to DanielGGordon/qmk_firmware that referenced this pull request May 30, 2018

Remap msys2 usb, fix USB port detection (qmk#2301)
* Add AVRDUDE to MSYS2 setup

* Remap detected USB port in MSYS2 to COM port

rcj added a commit to rcj/qmk_firmware that referenced this pull request Jun 12, 2018

Remap msys2 usb, fix USB port detection (qmk#2301)
* Add AVRDUDE to MSYS2 setup

* Remap detected USB port in MSYS2 to COM port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.