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

Error when flashing vea AVRDUDE in MSYS #2099

Closed
drashna opened this Issue Dec 4, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@drashna
Collaborator

drashna commented Dec 4, 2017

When using MSYS2 on Windows, and using :avrdude, it generates this error:

Detected controller on USB port at /dev/ttyS4
avrdude.exe: ser_open(): can't open device "/??/COM5": The system cannot find the path specified.


avrdude.exe done.  Thank you.

make[1]: *** [tmk_core/avr.mk:172: avrdude] Error 1
Make finished with errors

It looks like it's outputting the wrong string (/??/COM rather than just COM)

@Tiryoh

This comment has been minimized.

Tiryoh commented Feb 13, 2018

I don't have the Keyboard yet, but I think editing tmk_core/avr.mk in line 184-187 will solve the problem.
Would you mind trying this?

edit this file(tmk_core/avr.mk)
https://github.com/qmk/qmk_firmware/blob/c5d81a84a0519c78de1b5e165f5f2c1eb773bc11/tmk_core/avr.mk#L184-187

		echo ""; \
		echo "Detected controller on USB port at $$USB"; \
		sleep 1; \
		avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \

as this:

		echo ""; \
		if grep -q -s MSYS /proc/version; then \
			USB=`echo $$USB | sed -e 's/\/dev\/ttyS\([0-9]*\)/\1/g' | awk '{print "COM"$1+1}'`; \
		fi; \
		echo "Detected controller on USB port at $$USB"; \
		sleep 1; \
		avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \

Please be careful that you should indent with TABs in Makefile.

@Tiryoh

This comment has been minimized.

Tiryoh commented Feb 14, 2018

Thanks to pluis9, I think I found the way to fix this issue.
We need to edit this file(tmk_core/avr.mk)
https://github.com/qmk/qmk_firmware/blob/c5d81a84a0519c78de1b5e165f5f2c1eb773bc11/tmk_core/avr.mk#L184-187
as this:

		echo ""; \
		if grep -q -s MINGW64 /proc/version; then \
			USB=`echo "COM"$$(($$(echo $$USB | sed -e 's/\/dev\/ttyS\([0-9]*\)/\1/g') + 1))`; \
		fi; \
		echo "Detected controller on USB port at $$USB"; \
		sleep 1; \
		avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \

lesance

@drashna

This comment has been minimized.

Collaborator

drashna commented Feb 14, 2018

Nope, doesn't work here.

And are you on an older version?

@Tiryoh

This comment has been minimized.

Tiryoh commented Feb 14, 2018

@drashna,

Thanks for trying.

Nope, doesn't work here.

Do you mean that you got the same error like #2099 (comment)?

And are you on an older version?

I'm sorry to have confused you. I'm working on this version : b89e318
I specified c5d81a8 for the URL because this commit is the latest version of tmk_core/avr.mk.

@drashna

This comment has been minimized.

Collaborator

drashna commented Feb 14, 2018

Ah, doesn't help that I'm using a hacky hack for running MSYS2 (in VS2017). The second one works. I have to change it to MSYS because that's how it shows up in VS2017.

@Tiryoh

This comment has been minimized.

Tiryoh commented Feb 14, 2018

@drashna,

Thanks for the information.
I think this might work.

		echo ""; \
		if grep -q -s MINGW /proc/version || grep -q -s MSYS /proc/version; then \
			USB=`echo "COM"$$(($$(echo $$USB | sed -e 's/\/dev\/ttyS\([0-9]*\)/\1/g') + 1))`; \
		fi; \
		echo "Detected controller on USB port at $$USB"; \
		sleep 1; \
		avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
@drashna

This comment has been minimized.

Collaborator

drashna commented Feb 14, 2018

Success!! This work in MSYS, MINGW, and in my hacky whack-whack terminal session!

@drashna

This comment has been minimized.

Collaborator

drashna commented Feb 14, 2018

Checking another in progress PR... this looks cleaner:

if grep -q -s 'MINGW\|MSYS' /proc/version; then \

So, it would be:

		echo ""; \
		if grep -q -s 'MINGW\|MSYS' /proc/version; then \
			USB=`echo "COM"$$(($$(echo $$USB | sed -e 's/\/dev\/ttyS\([0-9]*\)/\1/g') + 1))`; \
		fi; \
		echo "Detected controller on USB port at $$USB"; \
		sleep 1; \
		avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment