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

Serial port - spaces in name #3693

Closed
beswickat opened this Issue Aug 17, 2015 · 8 comments

Comments

6 participants
@beswickat

On my Mac, the serial port appears as /"dev/cu.wch ch341 USB=>RS232 1440", including spaces which causes an error message like "avrdude: ser_open(): can't open device "/dev/cu.wch": No such file or directory"

Can't rename device to avoid the spaces.

Work around:
sudo ln cu.wch\ ch341\ USB=>RS232\ 1440 cu.wchrint

But this command has to be issued every time the USB is connected.

@ffissore

This comment has been minimized.

Show comment
Hide comment
@ffissore

ffissore Aug 18, 2015

Contributor

Also see #2244 which has been closed as wontfix

Contributor

ffissore commented Aug 18, 2015

Also see #2244 which has been closed as wontfix

@q2dg

This comment has been minimized.

Show comment
Hide comment
@q2dg

q2dg Aug 18, 2015

It's not an official board, so there shouldn't be official support. I'd close this issue.

q2dg commented Aug 18, 2015

It's not an official board, so there shouldn't be official support. I'd close this issue.

@matthijskooijman

This comment has been minimized.

Show comment
Hide comment
@matthijskooijman

matthijskooijman Aug 18, 2015

Collaborator

Is there a reason to not fix this anyway? Seems like it's a matter of changing platform.txt to add double quotes around the -P option?

@beswickat, could you try this perhaps? Find the arduino/avr/platform.txt file (somewhere within the Arduino app), find the line I linked above and replace it with:

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"

If that works, do you know how to submit a pullrequest by any chance?

Collaborator

matthijskooijman commented Aug 18, 2015

Is there a reason to not fix this anyway? Seems like it's a matter of changing platform.txt to add double quotes around the -P option?

@beswickat, could you try this perhaps? Find the arduino/avr/platform.txt file (somewhere within the Arduino app), find the line I linked above and replace it with:

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"

If that works, do you know how to submit a pullrequest by any chance?

@beswickat

This comment has been minimized.

Show comment
Hide comment
@beswickat

beswickat Aug 18, 2015

Hi
I just figured out a permanent fix for Mac and UNIX

cd /dev
sudo ln -s cu.wch\ ch341\ USB=>RS232\ 1440 cu.wch

This creates a shortcut to the name with spaces in it. The shortcut is not deleted when the IDE quits, and next time the IDE starts, the shortcut is there, waiting to point to the device whose name has spaces in it.

No idea about Windoze

cheers
Alan

On 18 Aug 2015, at 4:47 pm, Federico Fissore notifications@github.com wrote:

Also see #2244 which has been closed as wontfix


Reply to this email directly or view it on GitHub.

Hi
I just figured out a permanent fix for Mac and UNIX

cd /dev
sudo ln -s cu.wch\ ch341\ USB=>RS232\ 1440 cu.wch

This creates a shortcut to the name with spaces in it. The shortcut is not deleted when the IDE quits, and next time the IDE starts, the shortcut is there, waiting to point to the device whose name has spaces in it.

No idea about Windoze

cheers
Alan

On 18 Aug 2015, at 4:47 pm, Federico Fissore notifications@github.com wrote:

Also see #2244 which has been closed as wontfix


Reply to this email directly or view it on GitHub.

@beswickat

This comment has been minimized.

Show comment
Hide comment
@beswickat

beswickat Aug 18, 2015

Hi Matthijs
I have just discovered a work around :-)

On the Mac and other UNIX beasts, make a SYMBOLIC link
cd /dev
sudo ln -s cu.wch\ ch341\ USB=>RS232\ 1440 cu.wch

Now, /dev/cu.wch is a ‘shortcut’ to /dev/cu.wch\ ch341\ USB=>RS232\ 1440, and /dev/cu.wch can exist without /dev/cu.wch\ ch341\ USB=>RS232\ 1440 existing.

The serial device with the long name disappears when you shut down the Arduino, but the symbolic remains as a dangling link, normally to be avoided as it is a shortcut to a non-existing entity. However, when the Arduino IDE starts again, the serial device with the spaces in the name is recreated and the symbolic link now points to it again.

This is the first time in 30 years of UNIX programming that I have intentionally used a dangling link, but it works. :-)

On a Windoze box, a short cut to the appropriate file might work.

Also, I don’t know what a pull request is, sorry.

cheers
Alan (Brisbane, Australia)

On 18 Aug 2015, at 7:58 pm, Matthijs Kooijman notifications@github.com wrote:

Is there a reason to not fix this anyway? Seems like it's a matter of changing platform.txt to add double quotes around the -P option?

@beswickat, could you try this perhaps? Find the arduino/avr/platform.txt file (somewhere within the Arduino app), find the line I linked above and replace it with:

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"
If that works, do you know how to submit a pullrequest by any chance?


Reply to this email directly or view it on GitHub.

Hi Matthijs
I have just discovered a work around :-)

On the Mac and other UNIX beasts, make a SYMBOLIC link
cd /dev
sudo ln -s cu.wch\ ch341\ USB=>RS232\ 1440 cu.wch

Now, /dev/cu.wch is a ‘shortcut’ to /dev/cu.wch\ ch341\ USB=>RS232\ 1440, and /dev/cu.wch can exist without /dev/cu.wch\ ch341\ USB=>RS232\ 1440 existing.

The serial device with the long name disappears when you shut down the Arduino, but the symbolic remains as a dangling link, normally to be avoided as it is a shortcut to a non-existing entity. However, when the Arduino IDE starts again, the serial device with the spaces in the name is recreated and the symbolic link now points to it again.

This is the first time in 30 years of UNIX programming that I have intentionally used a dangling link, but it works. :-)

On a Windoze box, a short cut to the appropriate file might work.

Also, I don’t know what a pull request is, sorry.

cheers
Alan (Brisbane, Australia)

On 18 Aug 2015, at 7:58 pm, Matthijs Kooijman notifications@github.com wrote:

Is there a reason to not fix this anyway? Seems like it's a matter of changing platform.txt to add double quotes around the -P option?

@beswickat, could you try this perhaps? Find the arduino/avr/platform.txt file (somewhere within the Arduino app), find the line I linked above and replace it with:

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"
If that works, do you know how to submit a pullrequest by any chance?


Reply to this email directly or view it on GitHub.

smartperson added a commit to smartperson/Arduino that referenced this issue Jun 15, 2017

Fixed Serial Port Argument That May Include Spaces
Other paths in avrdude.upload.pattern are wrapped in double quotes, and
this -P{serial.port} causes issues with some platforms. This allows
serial port devices which include spaces and other characters. Without
this fix a /dev/tty* or /dev/cu* device that includes a space in its
name gets truncated when passed to avrdude. Error messages returned
from avrdude are cryptic, and workarounds (symlinks) are prone to
failure.

Fixes #3693
@smartperson

This comment has been minimized.

Show comment
Hide comment
@smartperson

smartperson Jun 15, 2017

Contributor

@matthijskooijman @beswickat I can confirm that this issue is resolved by editing platform.txt at Arduino.app/Contents/Java/hardware/arduino/avr/programmers.txt. I'll submit a pull request which might be rejected, as I believe new versions of the CH340 driver fix this issue. Perhaps Arduino official doesn't care about this issue, but it's good form to escape paths like these. The other paths on that line are double-quote wrapped, after all…

I had quite an experience tracking this problem down. I posted on my blog about its impact and the solution @matthijskooijman mentioned.

Contributor

smartperson commented Jun 15, 2017

@matthijskooijman @beswickat I can confirm that this issue is resolved by editing platform.txt at Arduino.app/Contents/Java/hardware/arduino/avr/programmers.txt. I'll submit a pull request which might be rejected, as I believe new versions of the CH340 driver fix this issue. Perhaps Arduino official doesn't care about this issue, but it's good form to escape paths like these. The other paths on that line are double-quote wrapped, after all…

I had quite an experience tracking this problem down. I posted on my blog about its impact and the solution @matthijskooijman mentioned.

@matthijskooijman

This comment has been minimized.

Show comment
Hide comment
@matthijskooijman

matthijskooijman Jun 15, 2017

Collaborator

@smartperson, that sounds like a familiar kind of ride: working your way through an issue and only when you completely diagnose it and know how to solve it, you have sufficient info to find an existing bug report for the issue :-)

In any case, thanks for testing the fix and the PR, I think there's no problem in merging it.

Collaborator

matthijskooijman commented Jun 15, 2017

@smartperson, that sounds like a familiar kind of ride: working your way through an issue and only when you completely diagnose it and know how to solve it, you have sufficient info to find an existing bug report for the issue :-)

In any case, thanks for testing the fix and the PR, I think there's no problem in merging it.

@beswickat

This comment has been minimized.

Show comment
Hide comment
@beswickat

beswickat Jun 15, 2017

@cmaglie cmaglie closed this in #6383 Jul 25, 2017

cmaglie added a commit that referenced this issue Jul 25, 2017

Fixed Serial Port Argument That May Include Spaces
Other paths in avrdude.upload.pattern are wrapped in double quotes, and
this -P{serial.port} causes issues with some platforms. This allows
serial port devices which include spaces and other characters. Without
this fix a /dev/tty* or /dev/cu* device that includes a space in its
name gets truncated when passed to avrdude. Error messages returned
from avrdude are cryptic, and workarounds (symlinks) are prone to
failure.

Fixes #3693

akshmakov pushed a commit to akshmakov/Arduino that referenced this issue Aug 2, 2017

Fixed Serial Port Argument That May Include Spaces
Other paths in avrdude.upload.pattern are wrapped in double quotes, and
this -P{serial.port} causes issues with some platforms. This allows
serial port devices which include spaces and other characters. Without
this fix a /dev/tty* or /dev/cu* device that includes a space in its
name gets truncated when passed to avrdude. Error messages returned
from avrdude are cryptic, and workarounds (symlinks) are prone to
failure.

Fixes #3693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment