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
Merged

Conversation

@nooges
Copy link
Member

@nooges nooges 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
Copy link
Member

@drashna drashna 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.

Loading

@nooges
Copy link
Member Author

@nooges nooges commented Jan 26, 2018

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

Loading

@drashna
Copy link
Member

@drashna drashna 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.

Loading

@nooges nooges force-pushed the remap-msys2-usb branch from a92ad2c to 6568412 Jan 29, 2018
@nooges
Copy link
Member Author

@nooges nooges commented Jan 29, 2018

Okay, fixed things up

Loading

@nooges
Copy link
Member Author

@nooges nooges commented Jan 31, 2018

@drashna Can you test this out again?

Loading

@drashna
Copy link
Member

@drashna drashna 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.

Loading

@nooges
Copy link
Member Author

@nooges nooges 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

Loading

@drashna
Copy link
Member

@drashna drashna 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)

Loading

tmk_core/avr.mk Outdated
@@ -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'`; \
Copy link
Member

@drashna drashna Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the flashing issue:

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

Loading

Copy link
Member

@drashna drashna Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would fix #2099

Loading

Copy link
Member Author

@nooges nooges Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Loading

Copy link
Member

@drashna drashna Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Loading

Copy link

@Tiryoh Tiryoh Feb 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Loading

@nooges nooges force-pushed the remap-msys2-usb branch from 0a341b5 to a196665 Feb 14, 2018
@drashna
Copy link
Member

@drashna drashna 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)

Loading

@jackhumbert
Copy link
Member

@jackhumbert jackhumbert commented Feb 28, 2018

Awesome - thanks!

Loading

@jackhumbert jackhumbert merged commit 524053e into qmk:master Feb 28, 2018
1 check passed
Loading
jrolfs added a commit to jrolfs/qmk that referenced this issue Mar 5, 2018
* Add AVRDUDE to MSYS2 setup

* Remap detected USB port in MSYS2 to COM port
@nooges nooges deleted the remap-msys2-usb branch Mar 23, 2018
@drashna drashna mentioned this pull request Mar 25, 2018
peel added a commit to peel/qmk_firmware that referenced this issue Mar 28, 2018
* 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 issue May 30, 2018
* 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 issue Jun 12, 2018
* 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants